Java Date Time - LocalDate until(ChronoLocalDate endDateExclusive) example








LocalDate until(ChronoLocalDate endDateExclusive) calculates the period between this date and another date as a Period.

Syntax

until has the following syntax.

public Period until(ChronoLocalDate endDateExclusive)

Example

The following example shows how to use until.

import java.time.LocalDate;
import java.time.Period;
/*from w  ww.j av  a2 s .c o  m*/
public class Main {
  public static void main(String[] args) {
    LocalDate a = LocalDate.of(2014, 6, 30);

    Period p = a.until(LocalDate.of(2015, 6, 30));
    
    System.out.println(p); 
  }
}

The code above generates the following result.