Language

ZonedDateTime.WithFixedOffsetZone Method

Definition

Returns a copy of this date-time with the zone ID set to the offset.

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

Returns

a ZonedDateTime with the zone ID set to the offset, not null

Attributes

Remarks

Returns a copy of this date-time with the zone ID set to the offset. This returns a zoned date-time where the zone ID is the same as getOffset(). The local date-time, offset and instant of the result will be the same as in this date-time. Setting the date-time to a fixed single offset means that any future calculations, such as addition or subtraction, have no complex edge cases due to time-zone rules. This might also be useful when sending a zoned date-time across a network, as most protocols, such as ISO-8601, only handle offsets, and not region-based zone IDs. This is equivalent to ZonedDateTime.of(zdt.toLocalDateTime(), zdt.getOffset()).

Java reference for java.time.ZonedDateTime.withFixedOffsetZone.

Applies to