I have two dates in an org.threeten.bp.LocalDateTime
object. I need to find the difference between these two dates in terms of days.
Asked
Active
Viewed 3,980 times
17
1 Answers
44
Use org.threeten.bp.temporal.ChronoUnit.between
:
long days = ChronoUnit.DAYS.between(fromDate, toDate);

wero
- 32,544
- 3
- 59
- 84
-
1Just a note - if you want time difference in minutes/seconds, you need to use `LocalDateTime` and not `LocalDate`, otherwise you get an exception. – RominaV Jun 25 '20 at 20:52