Java ChronoUnit get days between two LocalDate values

Description

Java ChronoUnit get days between two LocalDate values



import java.time.LocalDate;
import java.time.Month;
import java.time.temporal.ChronoUnit;

public class Main {
  public static void main(String[] args) {
    LocalDate ld1 = LocalDate.of(2020, Month.JANUARY, 7);
    LocalDate ld2 = LocalDate.of(2020, Month.MAY, 18);
    long days = ChronoUnit.DAYS.between(ld1, ld2);
    System.out.println(days);/*w  ww  .jav  a2  s .c  om*/
  }
}



PreviousNext

Related