OffsetDateTime.WithOffsetSameLocal(ZoneOffset) Method

Definition

Returns a copy of this OffsetDateTime with the specified offset ensuring that the result has the same local date-time.

[Android.Runtime.Register("withOffsetSameLocal", "(Ljava/time/ZoneOffset;)Ljava/time/OffsetDateTime;", "", ApiSince=26)]
public Java.Time.OffsetDateTime? WithOffsetSameLocal(Java.Time.ZoneOffset? offset);
[<Android.Runtime.Register("withOffsetSameLocal", "(Ljava/time/ZoneOffset;)Ljava/time/OffsetDateTime;", "", ApiSince=26)>]
member this.WithOffsetSameLocal : Java.Time.ZoneOffset -> Java.Time.OffsetDateTime

Parameters

offset
ZoneOffset

the zone offset to change to, not null

Returns

an OffsetDateTime based on this date-time with the requested offset, not null

Attributes

Remarks

Returns a copy of this OffsetDateTime with the specified offset ensuring that the result has the same local date-time. This method returns an object with the same LocalDateTime and the specified ZoneOffset. No calculation is needed or performed. For example, if this time represents 2007-12-03T10:30+02:00 and the offset specified is +03:00, then this method will return 2007-12-03T10:30+03:00. To take into account the difference between the offsets, and adjust the time fields, use withOffsetSameInstant(java.time.ZoneOffset). This instance is immutable and unaffected by this method call.

Java reference for java.time.OffsetDateTime.withOffsetSameLocal.

Applies to