OffsetTime query(TemporalQuery query) example
Description
OffsetTime query(TemporalQuery<R> query)
queries this 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.OffsetTime;
import java.time.ZoneOffset;
import java.time.temporal.TemporalQueries;
// ww w . ja va 2s.c o m
public class Main {
public static void main(String[] args) {
OffsetTime m = OffsetTime.now();
ZoneOffset n = m.query(TemporalQueries.offset());
System.out.println(n);
}
}
The code above generates the following result.