Java Language Calculate Difference between 2 LocalDates

Example

Use LocalDate and ChronoUnit:

LocalDate d1 = LocalDate.of(2017, 5, 1);
LocalDate d2 = LocalDate.of(2017, 5, 18);

now, since the method between of the ChronoUnit enumerator takes 2 Temporals as parameters so you can pass without a problem the LocalDate instances

long days = ChronoUnit.DAYS.between(d1, d2);
System.out.println( days );