Java 12 New Features from Coding compiler. It’s time for
Dates and Time (java.time.*)
Calculate Difference between 2 LocalDates 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 ); Related Article: How to … Read more