Instant query(TemporalQuery query) example

Description

Instant query(TemporalQuery<R> query) queries this instant 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.Instant;
import java.time.LocalDate;
import java.time.temporal.TemporalQueries;
/*w  ww. ja va2s.c  o  m*/
public class Main {
  public static void main(String[] args) {
    Instant instant = Instant.parse("2014-12-03T10:15:30.00Z");

    LocalDate z = instant.query( TemporalQueries.localDate());
    System.out.println(z);
 
  }
}




















Home »
  Java Date Time »
    java.time Reference »




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