Mr. Smee Mr. Smee - 1 month ago 16
Java Question

JodaTime Get Current Milliseconds From Beginning Of Day

I'm trying to get the current milliseconds from the Beginning of that day. So I would like to make the following calculation.

86400000-currMilliSecondsFromBeginningOfDay
. Any help would be greatly appreciated. Thanks

Answer
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());