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
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());
You can get the beginning of the day using DateMidnight from the jodatime library.
long todayStart = new DateMidnight().getMillis();
While DateTime constructor will set its millis field to current value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With