Skip to content

//core/io.islandtime/OffsetDateTime/Companion

Companion

common

object Companion

Properties

Name Summary
DefaultSortOrder

common


val DefaultSortOrder: Comparator<OffsetDateTime>

A Comparator that compares by instant, then date-time. Using this Comparator guarantees a deterministic order when sorting.
MAX

common


val MAX: OffsetDateTime

The latest supported OffsetDateTime, which can be used as a "far future" sentinel.
MIN

common


val MIN: OffsetDateTime

The earliest supported OffsetDateTime, which can be used as a "far past" sentinel.
TimelineOrder

common


val TimelineOrder: Comparator<TimePoint<*>>

A Comparator that compares by timeline order only, ignoring any offset differences.

Functions

Name Summary
fromMillisecondOfUnixEpoch

common


fun fromMillisecondOfUnixEpoch(millisecond: Long, offset: UtcOffset): OffsetDateTime

Creates an OffsetDateTime from the millisecond of the Unix epoch at offset.
fromMillisecondsSinceUnixEpoch

common


fun fromMillisecondsSinceUnixEpoch(milliseconds: Milliseconds, offset: UtcOffset): OffsetDateTime

Creates an OffsetDateTime from a duration of milliseconds relative to the Unix epoch at offset.
fromSecondOfUnixEpoch

common


fun fromSecondOfUnixEpoch(second: Long, nanosecond: Int = 0, offset: UtcOffset): OffsetDateTime

Creates an OffsetDateTime from the second of the Unix epoch at offset and optionally, the nanosecond of the second.
fromSecondsSinceUnixEpoch

common


fun fromSecondsSinceUnixEpoch(seconds: Seconds, nanosecondAdjustment: Nanoseconds = 0.nanoseconds, offset: UtcOffset): OffsetDateTime

Creates an OffsetDateTime from a duration of seconds relative to the Unix epoch at offset, optionally, with some number of additional nanoseconds added to it.
now

common


fun OffsetDateTime.Companion.now(): OffsetDateTime

Gets the current OffsetDateTime from the system clock.

common


fun OffsetDateTime.Companion.now(clock: Clock): OffsetDateTime

Gets the current OffsetDateTime from the provided clock.

jvm


fun OffsetDateTime.Companion.now(clock: Clock): OffsetDateTime

Gets the current OffsetDateTime from the provided clock.