Dela via


TemporalQueries.ZoneId Method

Definition

A strict query for the ZoneId.

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

Returns

a query that can obtain the zone ID of a temporal, not null

Attributes

Remarks

A strict query for the ZoneId.

This queries a TemporalAccessor for the zone. The zone is only returned if the date-time conceptually contains a ZoneId. It will not be returned if the date-time only conceptually has an ZoneOffset. Thus a java.time.ZonedDateTime will return the result of getZone(), but an java.time.OffsetDateTime will return null.

In most cases, applications should use #zone() as this query is too strict.

The result from JDK classes implementing TemporalAccessor is as follows:<br> LocalDate returns null<br> LocalTime returns null<br> LocalDateTime returns null<br> ZonedDateTime returns the associated zone<br> OffsetTime returns null<br> OffsetDateTime returns null<br> ChronoLocalDate returns null<br> ChronoLocalDateTime returns null<br> ChronoZonedDateTime returns the associated zone<br> Era returns null<br> DayOfWeek returns null<br> Month returns null<br> Year returns null<br> YearMonth returns null<br> MonthDay returns null<br> ZoneOffset returns null<br> Instant returns null<br>

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

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