Language

OffsetDateTime.AtZoneSimilarLocal(ZoneId) Method

Definition

Combines this date-time with a time-zone to create a ZonedDateTime trying to keep the same local date and time.

[Android.Runtime.Register("atZoneSimilarLocal", "(Ljava/time/ZoneId;)Ljava/time/ZonedDateTime;", "", ApiSince=26)]
public Java.Time.ZonedDateTime? AtZoneSimilarLocal(Java.Time.ZoneId? zone);
[<Android.Runtime.Register("atZoneSimilarLocal", "(Ljava/time/ZoneId;)Ljava/time/ZonedDateTime;", "", ApiSince=26)>]
member this.AtZoneSimilarLocal : Java.Time.ZoneId -> Java.Time.ZonedDateTime

Parameters

zone
ZoneId

the time-zone to use, not null

Returns

the zoned date-time formed from this date and the earliest valid time for the zone, not null

Attributes

Remarks

Combines this date-time with a time-zone to create a ZonedDateTime trying to keep the same local date and time. This returns a ZonedDateTime formed from this date-time and the specified time-zone. Where possible, the result will have the same local date-time as this object. Time-zone rules, such as daylight savings, mean that not every time on the local time-line exists. If the local date-time is in a gap or overlap according to the rules then a resolver is used to determine the resultant local time and offset. This method uses ZonedDateTime.ofLocal(LocalDateTime, ZoneId, ZoneOffset) to retain the offset from this instance if possible. Finer control over gaps and overlaps is available in two ways. If you simply want to use the later offset at overlaps then call ZonedDateTime.withLaterOffsetAtOverlap() immediately after this method. To create a zoned date-time at the same instant irrespective of the local time-line, use atZoneSameInstant(ZoneId). To use the offset as the zone ID, use toZonedDateTime().

Java reference for java.time.OffsetDateTime.atZoneSimilarLocal.

Applies to