ZonedDateTime.WithZoneSameLocal(ZoneId) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a copy of this date-time with a different time-zone, retaining the local date-time if possible.
[Android.Runtime.Register("withZoneSameLocal", "(Ljava/time/ZoneId;)Ljava/time/ZonedDateTime;", "", ApiSince=26)]
public Java.Time.ZonedDateTime? WithZoneSameLocal(Java.Time.ZoneId? zone);
[<Android.Runtime.Register("withZoneSameLocal", "(Ljava/time/ZoneId;)Ljava/time/ZonedDateTime;", "", ApiSince=26)>]
member this.WithZoneSameLocal : 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 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, determined using the same approach as ofLocal(LocalDateTime, ZoneId, ZoneOffset). 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.ZonedDateTime.withZoneSameLocal.