【发布时间】:2011-06-11 18:27:57
【问题描述】:
如何将System.currentTimeMillis();转换为秒?
long start6=System.currentTimeMillis();
System.out.println(counter.countPrimes(100000000)+" for "+start6);
控制台显示5761455 for 1307816001290。
我不知道那是多少秒。
有什么帮助吗?
【问题讨论】:
-
long s = System.currentTimeMilis() / 1000L -
Try Instant 会更清楚:long s = Instant.now().getEpochSecond();
标签: java milliseconds