LocalDate until(ChronoLocalDate endDateExclusive) example

Description

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;
//  w  w w . ja v  a 2s.co  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.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset