ZonedDateTime query(TemporalQuery<R> query)
queries this date-time using the specified query.
query
has the following syntax.
public <R> R query(TemporalQuery<R> query)
The following example shows how to use query
.
import java.time.LocalDate; import java.time.ZonedDateTime; import java.time.temporal.TemporalQueries; /*w w w.ja v a 2s.c om*/ 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.