core / io.islandtime / similarLocalTimeAt

similarLocalTimeAt

(iosArm64, iosX64, jvm, macosX64) fun OffsetDateTime.similarLocalTimeAt(zone: TimeZone): ZonedDateTime

Get the ZonedDateTime corresponding to a local date, time, and offset in a particular time zone. The offset will be preserved if it is valid based on the rules of the time zone.

Due to daylight savings time transitions, there a few complexities to be aware of. If the local time falls within a gap (meaning it doesn't exist), it will adjusted forward by the length of the gap. If it falls within an overlap (meaning the local time exists twice), the earlier offset will be used.