I've got two LocalDate
s:
LocalDate date1;
LocalDate date2;
//...
How to find the number of days between those dates?
I've got two LocalDate
s:
LocalDate date1;
LocalDate date2;
//...
How to find the number of days between those dates?
LocalDate.until
is what you're looking for. (LocalDate implements Temporal, which is what Days accepts, and ChronoUnit is a library of TemporalUnit instances.)
long days = date1.until(date2, ChronoUnit.DAYS);
I would do something like
long daysBetween = DAYS.between(date1, date2);