TemporalQueries.Zone Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A lenient query for the ZoneId
, falling back to the ZoneOffset
.
[Android.Runtime.Register("zone", "()Ljava/time/temporal/TemporalQuery;", "", ApiSince=26)]
public static Java.Time.Temporal.ITemporalQuery? Zone ();
[<Android.Runtime.Register("zone", "()Ljava/time/temporal/TemporalQuery;", "", ApiSince=26)>]
static member Zone : unit -> Java.Time.Temporal.ITemporalQuery
Returns
a query that can obtain the zone ID or offset of a temporal, not null
- Attributes
Remarks
A lenient query for the ZoneId
, falling back to the ZoneOffset
.
This queries a TemporalAccessor
for the zone. It first tries to obtain the zone, using #zoneId()
. If that is not found it tries to obtain the #offset()
. Thus a java.time.ZonedDateTime
will return the result of getZone()
, while an java.time.OffsetDateTime
will return the result of getOffset()
.
In most cases, applications should use this query rather than #zoneId()
.
The method ZoneId#from(TemporalAccessor)
can be used as a TemporalQuery
via a method reference, ZoneId::from
. That method is equivalent to this query, except that it throws an exception if a zone cannot be obtained.
Java documentation for java.time.temporal.TemporalQueries.zone()
.
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.