关于 jFreeChart 的 Millisecond ,
我怎样才能得到 java.util.Date来自 Millisecond
实例的对象?
从文档中,似乎只能在 Millisecond
中减去毫秒数。
由于 Millisecond
对象是这样构造的:
Millisecond ms = new Millisecond(
millisec,
second,
minute,
hour,
day,
month,
year);
我应该也能提取一个有效的 Date
对象。
编辑
我需要一个 Date
对象,它可以返回精确到毫秒的精确时间。
.getStart()
提供这个吗?
[回答]:是
最佳答案
毫秒与 JFreeChart 中的任何其他 RegularTimePeriod 一样,因此您可以
Date d = ms.getStart();
或
Date d = ms.getEnd();
取决于您想要一个日期是指毫秒的开始还是结束(两种方式的值相同)。
参见 The JFreeChart API了解更多信息。
编辑:在此处添加代码,因为注释会破坏格式:
Millisecond ms = new Millisecond();
System.out.println(ms.getStart().getTime());
System.out.println(ms.getEnd().getTime());
将打印相同的毫秒数两次。
关于java - 从 jFreeChart 毫秒到 java.util.Date,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22547168/