ZonedDateTime query(TemporalQuery query) example
Description
ZonedDateTime query(TemporalQuery<R> query)
queries this date-time 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.ZonedDateTime;
import java.time.temporal.TemporalQueries;
/* www. j a va 2 s. c o m*/
public class Main {
public static void main(String[] args) {
ZonedDateTime dateTime = ZonedDateTime.now();
LocalDate o = dateTime.query(TemporalQueries.localDate());
System.out.println(o);
}
}
The code above generates the following result.