VOOZH about

URL: https://www.geeksforgeeks.org/java/zoneoffset-querytemporalquery-method-in-java-with-examples/

⇱ ZoneOffset query(TemporalQuery) method in Java with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

ZoneOffset query(TemporalQuery) method in Java with Examples

Last Updated : 13 Dec, 2018
The query(TemporalQuery) method of ZoneOffset Class in java.time package is used to execute a query this ZoneOffset using the TemporalQuery passed as the parameter. This method returns the query result in the form of specified type. Syntax:
public <R> R query(TemporalQuery<R> temporalQuery)
Parameters: This method accepts a parameter TemporalQuery which is the query to be executed upon on this ZoneOffset. Return Value: This method returns a R type query result of the specified query. Exceptions: This method throws:
  • DateTimeException: if unable to query (defined by the query).
  • ArithmeticException: if numeric overflow occurs (defined by the query).
Below examples illustrate the ZoneOffset.query() method: Example 1:
Output:
ZoneOffset: +05:30
Offset value: +05:30
Example 2:
Output:
ZoneOffset: Z
Zone value: Z
Reference: Oracle Doc
Comment