Share via


IChronoLocalDateTime.AtZone(ZoneId) Method

Definition

Combines this time with a time-zone to create a ChronoZonedDateTime.

[Android.Runtime.Register("atZone", "(Ljava/time/ZoneId;)Ljava/time/chrono/ChronoZonedDateTime;", "GetAtZone_Ljava_time_ZoneId_Handler:Java.Time.Chrono.IChronoLocalDateTimeInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)]
public Java.Time.Chrono.IChronoZonedDateTime? AtZone (Java.Time.ZoneId? zone);
[<Android.Runtime.Register("atZone", "(Ljava/time/ZoneId;)Ljava/time/chrono/ChronoZonedDateTime;", "GetAtZone_Ljava_time_ZoneId_Handler:Java.Time.Chrono.IChronoLocalDateTimeInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)>]
abstract member AtZone : Java.Time.ZoneId -> Java.Time.Chrono.IChronoZonedDateTime

Parameters

zone
ZoneId

the time-zone to use, not null

Returns

the zoned date-time formed from this date-time, not null

Attributes

Remarks

Combines this time with a time-zone to create a ChronoZonedDateTime.

This returns a ChronoZonedDateTime formed from this date-time at the specified time-zone. The result will match this date-time as closely as possible. Time-zone rules, such as daylight savings, mean that not every local date-time is valid for the specified zone, thus the local date-time may be adjusted.

The local date-time is resolved to a single instant on the time-line. This is achieved by finding a valid offset from UTC/Greenwich for the local date-time as defined by the ZoneRules rules of the zone ID.

In most cases, there is only one valid offset for a local date-time. In the case of an overlap, where clocks are set back, there are two valid offsets. This method uses the earlier offset typically corresponding to "summer".

In the case of a gap, where clocks jump forward, there is no valid offset. Instead, the local date-time is adjusted to be later by the length of the gap. For a typical one hour daylight savings change, the local date-time will be moved one hour later into the offset typically corresponding to "summer".

To obtain the later offset during an overlap, call ChronoZonedDateTime#withLaterOffsetAtOverlap() on the result of this method.

Java documentation for java.time.chrono.ChronoLocalDateTime.atZone(java.time.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