core / io.islandtime / Instant

Instant

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

An instant in time with nanosecond precision.

Properties

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

additionalNanosecondsSinceUnixEpoch

The number of additional nanoseconds on top of secondsSinceUnixEpoch.

val additionalNanosecondsSinceUnixEpoch: IntNanoseconds
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

millisecondOfUnixEpoch

The millisecond of the Unix epoch.

val millisecondOfUnixEpoch: Long
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

millisecondsSinceUnixEpoch

The number of milliseconds since the Unix epoch of 1970-01-01T00:00Z.

val millisecondsSinceUnixEpoch: LongMilliseconds
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

nanosecond

The nanosecond of the second.

val nanosecond: Int
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

secondOfUnixEpoch

The second of the Unix epoch.

val secondOfUnixEpoch: Long
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

secondsSinceUnixEpoch

The number of seconds since the Unix epoch of 1970-01-01T00:00Z.

val secondsSinceUnixEpoch: LongSeconds

Functions

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

compareTo

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

equals

fun equals(other: Any?): Boolean
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

hashCode

fun hashCode(): Int
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

minus

operator fun minus(other: Duration): Instant
operator fun minus(days: IntDays): Instant
operator fun minus(days: LongDays): Instant
operator fun minus(hours: IntHours): Instant
operator fun minus(hours: LongHours): Instant
operator fun minus(minutes: IntMinutes): Instant
operator fun minus(minutes: LongMinutes): Instant
operator fun minus(seconds: IntSeconds): Instant
operator fun minus(seconds: LongSeconds): Instant
operator fun minus(milliseconds: IntMilliseconds): Instant
operator fun minus(milliseconds: LongMilliseconds): Instant
operator fun minus(microseconds: IntMicroseconds): Instant
operator fun minus(microseconds: LongMicroseconds): Instant
operator fun minus(nanoseconds: IntNanoseconds): Instant
operator fun minus(nanoseconds: LongNanoseconds): Instant
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

plus

operator fun plus(other: Duration): Instant
operator fun plus(days: IntDays): Instant
operator fun plus(days: LongDays): Instant
operator fun plus(hours: IntHours): Instant
operator fun plus(hours: LongHours): Instant
operator fun plus(minutes: IntMinutes): Instant
operator fun plus(minutes: LongMinutes): Instant
operator fun plus(seconds: IntSeconds): Instant
operator fun plus(seconds: LongSeconds): Instant
operator fun plus(milliseconds: IntMilliseconds): Instant
operator fun plus(milliseconds: LongMilliseconds): Instant
operator fun plus(microseconds: IntMicroseconds): Instant
operator fun plus(microseconds: LongMicroseconds): Instant
operator fun plus(nanoseconds: IntNanoseconds): Instant
operator fun plus(nanoseconds: LongNanoseconds): Instant
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

rangeTo

operator fun rangeTo(other: Instant): InstantInterval

toString

Converts this instant to a string in ISO-8601 extended format. For example, 2020-02-13T02:30:05.367Z.

(iosArm64, iosX64, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) fun toString(): <ERROR CLASS>
(jvm) fun toString(): String

Companion Object Properties

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

MAX

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

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

MIN

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

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

UNIX_EPOCH

The Instant representing the Unix epoch of 1970-01-01T00:00Z.

val UNIX_EPOCH: Instant

Companion Object Functions

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

fromMillisecondOfUnixEpoch

Creates an Instant from the millisecond of the Unix epoch.

fun fromMillisecondOfUnixEpoch(millisecond: Long): Instant
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

fromSecondOfUnixEpoch

Creates an Instant from the second of the Unix epoch.

fun fromSecondOfUnixEpoch(second: Long): Instant
fun fromSecondOfUnixEpoch(second: Long, nanosecond: Int): Instant
fun fromSecondOfUnixEpoch(second: Long, nanosecond: Long): Instant
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

fromUnixEpochMillisecond

fun fromUnixEpochMillisecond(millisecond: Long): Instant
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

fromUnixEpochSecond

fun fromUnixEpochSecond(second: Long): Instant
fun fromUnixEpochSecond(second: Long, nanosecondAdjustment: Int): Instant
fun fromUnixEpochSecond(second: Long, nanosecondAdjustment: Long): Instant

Extension Functions

(jvm)

toJavaInstant

Convert to an equivalent Java Instant.

fun Instant.toJavaInstant(): Instant