Skip to content

//core/io.islandtime/UtcOffset

UtcOffset

@Serializable(with = UtcOffsetIsoSerializer::class)

@JvmInline

value class UtcOffset : Comparable<UtcOffset>

The time shift between a local time and UTC.

Parameters

common

totalSecondsValue the total number of seconds to offset by

Throws

DateTimeException if the offset is outside the supported range

Constructors

UtcOffset

common

constructor(totalSeconds: Seconds)

Creates an offset from the number of seconds relative to UTC.

Types

Name Summary
Companion

common


object Companion

Properties

Name Summary
totalSeconds

common


val totalSeconds: Seconds

The number of seconds relative to UTC.
totalSecondsValue

common


val totalSecondsValue: Int

The number of seconds relative to UTC.

Functions

Name Summary
asTimeZone

common


fun UtcOffset.asTimeZone(): TimeZone

Converts this UtcOffset into a fixed-offset TimeZone.
compareTo

common


open operator override fun compareTo(other: UtcOffset): Int
isZero

common


fun isZero(): Boolean

Checks if this is the UTC offset of +00:00.
toComponents

common


inline fun <T> toComponents(action: (hours: Hours, minutes: Minutes, seconds: Seconds) -> T): T

Breaks a UTC offset down into components. If the offset is negative, each component will be negative.

common


inline fun <T> toComponents(action: (sign: Int, hours: Hours, minutes: Minutes, seconds: Seconds) -> T): T

Breaks a UTC offset down into components. The sign will indicate whether the offset is positive or negative while each component will be positive.
toComponentValues

common


inline fun <T> toComponentValues(action: (hours: Int, minutes: Int, seconds: Int) -> T): T

Breaks a UTC offset down into components. If the offset is negative, each component will be negative.

common


inline fun <T> toComponentValues(action: (sign: Int, hours: Int, minutes: Int, seconds: Int) -> T): T

Breaks a UTC offset down into components. The sign will indicate whether the offset is positive or negative while each component will be positive.
toJavaZoneOffset

jvm


fun UtcOffset.toJavaZoneOffset(): ZoneOffset

Converts this UTC offset to an equivalent Java ZoneOffset.
toNSTimeZone

darwin


fun UtcOffset.toNSTimeZone(): <Error class: unknown class>

Converts this offset into an equivalent NSTimeZone with a fixed UTC offset.
toString

common


open override fun toString(): String

Converts this offset to a string in ISO-8601 extended format. For example, -04:00 or Z.