TemporalQueries.Offset Method

Definition

A query for ZoneOffset returning null if not found.

[Android.Runtime.Register("offset", "()Ljava/time/temporal/TemporalQuery;", "", ApiSince=26)]
public static Java.Time.Temporal.ITemporalQuery? Offset ();
[<Android.Runtime.Register("offset", "()Ljava/time/temporal/TemporalQuery;", "", ApiSince=26)>]
static member Offset : unit -> Java.Time.Temporal.ITemporalQuery

Returns

a query that can obtain the offset of a temporal, not null

Attributes

Remarks

A query for ZoneOffset returning null if not found.

This returns a TemporalQuery that can be used to query a temporal object for the offset. The query will return null if the temporal object cannot supply an offset.

The query implementation examines the ChronoField#OFFSET_SECONDS OFFSET_SECONDS field and uses it to create a ZoneOffset.

The method java.time.ZoneOffset#from(TemporalAccessor) can be used as a TemporalQuery via a method reference, ZoneOffset::from. This query and ZoneOffset::from will return the same result if the temporal object contains an offset. If the temporal object does not contain an offset, then the method reference will throw an exception, whereas this query will return null.

Java documentation for java.time.temporal.TemporalQueries.offset().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to