UtcOffset

value class UtcOffset : Comparable<UtcOffset>

The time shift between a local time and UTC.

Parameters

totalSecondsValue

the total number of seconds to offset by

Throws

if the offset is outside the supported range

Constructors

UtcOffset
Link copied to clipboard
common
fun UtcOffset(totalSeconds: Seconds)

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

Types

Companion
Link copied to clipboard
common
object Companion

Functions

compareTo
Link copied to clipboard
common
open operator override fun compareTo(other: UtcOffset): Int
isZero
Link copied to clipboard
common
fun isZero(): Boolean

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

toComponents
Link copied to clipboard
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.

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
Link copied to clipboard
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.

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.

toString
Link copied to clipboard
common
open override fun toString(): String

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

Properties

totalSeconds
Link copied to clipboard
common
val totalSeconds: Seconds

The number of seconds relative to UTC.

totalSecondsValue
Link copied to clipboard
common
val totalSecondsValue: Int

The number of seconds relative to UTC.

Extensions

asTimeZone
Link copied to clipboard
common
fun UtcOffset.asTimeZone(): TimeZone

Converts this UtcOffset into a fixed-offset TimeZone.

toJavaZoneOffset
Link copied to clipboard
fun UtcOffset.toJavaZoneOffset(): ZoneOffset

Converts this UTC offset to an equivalent Java ZoneOffset.

toNSTimeZone
Link copied to clipboard
darwin
fun UtcOffset.toNSTimeZone(): <ERROR CLASS>

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