ZonedDateTime.WithZoneSameInstant(ZoneId) Method

Definition

Returns a copy of this date-time with a different time-zone, retaining the instant.

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

Parameters

zone
ZoneId

the time-zone to change to, not null

Returns

a ZonedDateTime based on this date-time with the requested zone, not null

Attributes

Remarks

Returns a copy of this date-time with a different time-zone, retaining the instant. This method changes the time-zone and retains the instant. This normally results in a change to the local date-time. This method is based on retaining the same instant, thus gaps and overlaps in the local time-line have no effect on the result. To change the offset while keeping the local time, use withZoneSameLocal(ZoneId).

Java reference for java.time.ZonedDateTime.withZoneSameInstant.

Applies to