core / io.islandtime / UtcOffset

UtcOffset

(iosArm64, iosX64, jvm, macosX64) 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 validated.

Parameters

totalSeconds - the total number of seconds to offset by

See Also

validated

Constructors

(iosArm64, iosX64, jvm, macosX64)

<init>

The time shift between a local time and UTC.

<init>(totalSeconds: IntSeconds)

Properties

(iosArm64, iosX64, jvm, macosX64)

isValid

Check if this offset is within the supported range.

val isValid: Boolean
(iosArm64, iosX64, jvm, macosX64)

totalSeconds

the total number of seconds to offset by

val totalSeconds: IntSeconds

Functions

(iosArm64, iosX64, jvm, macosX64)

compareTo

fun compareTo(other: UtcOffset): Int
(iosArm64, iosX64, jvm, macosX64)

isZero

Is this the UTC offset of +00:00?

fun isZero(): Boolean
(iosArm64, iosX64, jvm, macosX64)

toComponents

Break 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

Break 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)

toString

fun toString(): String
(iosArm64, iosX64, jvm, macosX64)

validate

Check if the offset is valid and throw an exception if it isn't.

fun validate(): Unit
(iosArm64, iosX64, jvm, macosX64)

validated

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

fun validated(): UtcOffset

Companion Object Properties

(iosArm64, iosX64, jvm, macosX64)

MAX

val MAX: UtcOffset
(iosArm64, iosX64, jvm, macosX64)

MAX_TOTAL_SECONDS

val MAX_TOTAL_SECONDS: IntSeconds
(iosArm64, iosX64, jvm, macosX64)

MIN

val MIN: UtcOffset
(iosArm64, iosX64, jvm, macosX64)

MIN_TOTAL_SECONDS

val MIN_TOTAL_SECONDS: IntSeconds
(iosArm64, iosX64, jvm, macosX64)

ZERO

val ZERO: UtcOffset

Extension Functions

(jvm)

toJavaZoneOffset

fun UtcOffset.toJavaZoneOffset(): ZoneOffset