LocalDate query(TemporalQuery query) example

Description

LocalDate query(TemporalQuery<R> query) queries this date using the specified query.

Syntax

query has the following syntax.


public <R> R query(TemporalQuery<R> query)

Example

The following example shows how to use query.


import java.time.LocalDate;
import java.time.temporal.TemporalQueries;
/*w w  w. ja  v  a 2 s . co m*/
public class Main {
  public static void main(String[] args) {
    LocalDate a = LocalDate.of(2014, 6, 30);
    LocalDate b = a.query(TemporalQueries.localDate());
    System.out.println(b);
  }
}

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