core / io.islandtime / UtcOffset

UtcOffset

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) inline class UtcOffset : Comparable<UtcOffset>

The time shift between a local time and UTC.

To ensure that the offset is within the valid supported range, you must explicitly call validate or validated.

Parameters

totalSeconds - the total number of seconds to offset by

See Also

validate

validated

Constructors

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

<init>

The time shift between a local time and UTC.

<init>(totalSeconds: IntSeconds)

Properties

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

isValid

Checks if this offset is within the supported range.

val isValid: Boolean
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

totalSeconds

the total number of seconds to offset by

val totalSeconds: IntSeconds

Functions

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

compareTo

fun compareTo(other: UtcOffset): Int
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

isZero

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

fun isZero(): Boolean
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

toComponents

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

fun <T> toComponents(action: (sign: Int, hours: IntHours, minutes: IntMinutes, seconds: IntSeconds) -> T): T

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

fun <T> toComponents(action: (hours: IntHours, minutes: IntMinutes, seconds: IntSeconds) -> T): T
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

toString

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

fun toString(): String
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

validate

Checks if the offset is valid and throws an exception if it isn't.

fun validate(): Unit
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

validated

Ensures that the offset is valid, throwing an exception if it isn't.

fun validated(): UtcOffset

Companion Object Properties

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

MAX

val MAX: UtcOffset
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

MAX_TOTAL_SECONDS

val MAX_TOTAL_SECONDS: IntSeconds
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

MIN

val MIN: UtcOffset
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

MIN_TOTAL_SECONDS

val MIN_TOTAL_SECONDS: IntSeconds
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

ZERO

val ZERO: UtcOffset

Extension Functions

(jvm)

toJavaZoneOffset

Convert to an equivalent Java ZoneOffset.

fun UtcOffset.toJavaZoneOffset(): ZoneOffset