Java – jodatime gets the current number of milliseconds from one day

I tried to get the current number of milliseconds from the beginning of that day So I want to do the following calculation 86400000-currMilliSecondsFromBeginningOfDay. Any help would be appreciated thank you

Solution

long result = new DateTime().millisOfDay().getMillis();
long result = new DateTime().millisOfDay().getMillis();

or

long result = new DateTime().getMillis() - new DateTime().withMillisOfDay(0).getMillis();

or

long result = new LocalTime().get(DateTimeFieldType.millisOfDay());
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>