Language

ZonedDateTime.IChronoZonedDateTime.WithZoneSameLocal(ZoneId) Method

Definition

Returns a copy of this date-time with a different time-zone, retaining the local date-time if possible.

Java.Time.Chrono.IChronoZonedDateTime? IChronoZonedDateTime.WithZoneSameLocal(Java.Time.ZoneId? zone);
abstract member Java.Time.Chrono.IChronoZonedDateTime.WithZoneSameLocal : Java.Time.ZoneId -> Java.Time.Chrono.IChronoZonedDateTime
override this.Java.Time.Chrono.IChronoZonedDateTime.WithZoneSameLocal : Java.Time.ZoneId -> Java.Time.Chrono.IChronoZonedDateTime

Parameters

zone
ZoneId

the time-zone to change to, not null

Returns

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

Implements

Remarks

Returns a copy of this date-time with a different time-zone, retaining the local date-time if possible. This method changes the time-zone and retains the local date-time. The local date-time is only changed if it is invalid for the new zone. To change the zone and adjust the local date-time, use withZoneSameInstant(ZoneId). This instance is immutable and unaffected by this method call.

Java reference for java.time.chrono.ChronoZonedDateTime.withZoneSameLocal.

Applies to