Instant

class Instant : TimePoint<Instant> , Comparable<Instant>

An instant in time with nanosecond-precision.

Types

Companion
Link copied to clipboard
common
object Companion

Functions

compareTo
Link copied to clipboard
common
open operator fun compareTo(other: TimePoint<*>): Int
Compares this time point with another time point.
open operator override fun compareTo(other: Instant): Int
equals
Link copied to clipboard
common
open operator override fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
common
open override fun hashCode(): Int
isSameInstantAs
Link copied to clipboard
common
open fun isSameInstantAs(other: TimePoint<*>): Boolean
Checks if this time point represents the same instant as other.
minus
Link copied to clipboard
common
operator fun minus(other: Duration): Instant
operator fun minus(days: IntDays): Instant
open operator override fun minus(hours: IntHours): Instant
open operator override fun minus(microseconds: IntMicroseconds): Instant
open operator override fun minus(milliseconds: IntMilliseconds): Instant
open operator override fun minus(minutes: IntMinutes): Instant
open operator override fun minus(nanoseconds: IntNanoseconds): Instant
open operator override fun minus(seconds: IntSeconds): Instant
operator fun minus(days: LongDays): Instant
open operator override fun minus(hours: LongHours): Instant
open operator override fun minus(microseconds: LongMicroseconds): Instant
open operator override fun minus(milliseconds: LongMilliseconds): Instant
open operator override fun minus(minutes: LongMinutes): Instant
open operator override fun minus(nanoseconds: LongNanoseconds): Instant
open operator override fun minus(seconds: LongSeconds): Instant
plus
Link copied to clipboard
common
operator fun plus(other: Duration): Instant
operator fun plus(days: IntDays): Instant
open operator override fun plus(hours: IntHours): Instant
open operator override fun plus(microseconds: IntMicroseconds): Instant
open operator override fun plus(milliseconds: IntMilliseconds): Instant
open operator override fun plus(minutes: IntMinutes): Instant
open operator override fun plus(nanoseconds: IntNanoseconds): Instant
open operator override fun plus(seconds: IntSeconds): Instant
operator fun plus(days: LongDays): Instant
open operator override fun plus(hours: LongHours): Instant
open operator override fun plus(microseconds: LongMicroseconds): Instant
open operator override fun plus(milliseconds: LongMilliseconds): Instant
open operator override fun plus(minutes: LongMinutes): Instant
open operator override fun plus(nanoseconds: LongNanoseconds): Instant
open operator override fun plus(seconds: LongSeconds): Instant
rangeTo
Link copied to clipboard
common
operator fun rangeTo(other: Instant): InstantInterval
toString
Link copied to clipboard
common
open override fun toString(): String
Converts this instant to a string in ISO-8601 extended format.

Properties

additionalNanosecondsSinceUnixEpoch
Link copied to clipboard
common
open override val additionalNanosecondsSinceUnixEpoch: IntNanoseconds
The number of additional nanoseconds on top of secondsSinceUnixEpoch.
millisecondOfUnixEpoch
Link copied to clipboard
common
open override val millisecondOfUnixEpoch: Long
The millisecond of the Unix epoch.
millisecondsSinceUnixEpoch
Link copied to clipboard
common
open override val millisecondsSinceUnixEpoch: LongMilliseconds
The number of milliseconds since the Unix epoch of 1970-01-01T00:00Z.
nanosecond
Link copied to clipboard
common
open override val nanosecond: Int
The nanosecond of the second.
secondOfUnixEpoch
Link copied to clipboard
common
open override val secondOfUnixEpoch: Long
The second of the Unix epoch.
secondsSinceUnixEpoch
Link copied to clipboard
common
open override val secondsSinceUnixEpoch: LongSeconds
The number of seconds since the Unix epoch of 1970-01-01T00:00Z.

Extensions

at
Link copied to clipboard
common
infix fun Instant.at(offset: UtcOffset): OffsetDateTime
Combines an instant with a UTC offset to create an OffsetDateTime.
infix fun Instant.at(zone: TimeZone): ZonedDateTime
Combines an instant with a time zone to create a ZonedDateTime.
roundedDownTo
Link copied to clipboard
common
fun Instant.roundedDownTo(unit: TimeUnit): Instant
Returns this instant, rounded down to match the precision of a given unit.
roundedDownToNearest
Link copied to clipboard
common
fun Instant.roundedDownToNearest(increment: IntHours): Instant
Returns this instant, rounded down to the nearest hour that satisfies the increment.
fun Instant.roundedDownToNearest(increment: IntMinutes): Instant
Returns this instant, rounded down to the nearest minute that satisfies the increment.
fun Instant.roundedDownToNearest(increment: IntSeconds): Instant
Returns this instant, rounded down to the nearest second that satisfies the increment.
fun Instant.roundedDownToNearest(increment: IntMilliseconds): Instant
Returns this instant, rounded down to the nearest millisecond that satisfies the increment.
fun Instant.roundedDownToNearest(increment: IntMicroseconds): Instant
Returns this instant, rounded down to the nearest microsecond that satisfies the increment.
fun Instant.roundedDownToNearest(increment: IntNanoseconds): Instant
Returns this instant, rounded down to the nearest nanosecond that satisfies the increment.
roundedTo
Link copied to clipboard
common
fun Instant.roundedTo(unit: TimeUnit): Instant
Returns this instant, rounded to match the precision of a given unit.
roundedToNearest
Link copied to clipboard
common
fun Instant.roundedToNearest(increment: IntHours): Instant
Returns this instant, rounded to the nearest hour that satisfies the increment.
fun Instant.roundedToNearest(increment: IntMinutes): Instant
Returns this instant, rounded to the nearest minute that satisfies the increment.
fun Instant.roundedToNearest(increment: IntSeconds): Instant
Returns this instant, rounded to the nearest second that satisfies the increment.
fun Instant.roundedToNearest(increment: IntMilliseconds): Instant
Returns this instant, rounded to the nearest millisecond that satisfies the increment.
fun Instant.roundedToNearest(increment: IntMicroseconds): Instant
Returns this instant, rounded to the nearest microsecond that satisfies the increment.
fun Instant.roundedToNearest(increment: IntNanoseconds): Instant
Returns this instant, rounded to the nearest nanosecond that satisfies the increment.
roundedUpTo
Link copied to clipboard
common
fun Instant.roundedUpTo(unit: TimeUnit): Instant
Returns this instant, rounded up to match the precision of a given unit.
roundedUpToNearest
Link copied to clipboard
common
fun Instant.roundedUpToNearest(increment: IntHours): Instant
Returns this instant, rounded up to the nearest hour that satisfies the increment.
fun Instant.roundedUpToNearest(increment: IntMinutes): Instant
Returns this instant, rounded up to the nearest minute that satisfies the increment.
fun Instant.roundedUpToNearest(increment: IntSeconds): Instant
Returns this instant, rounded up to the nearest second that satisfies the increment.
fun Instant.roundedUpToNearest(increment: IntMilliseconds): Instant
Returns this instant, rounded up to the nearest millisecond that satisfies the increment.
fun Instant.roundedUpToNearest(increment: IntMicroseconds): Instant
Returns this instant, rounded up to the nearest microsecond that satisfies the increment.
fun Instant.roundedUpToNearest(increment: IntNanoseconds): Instant
Returns this instant, rounded up to the nearest nanosecond that satisfies the increment.
toDateAt
Link copied to clipboard
common
fun Instant.toDateAt(offset: UtcOffset): Date
Converts this instant to the corresponding Date at offset.
fun Instant.toDateAt(zone: TimeZone): Date
Converts this instant to the corresponding Date in zone.
toDateTimeAt
Link copied to clipboard
common
fun Instant.toDateTimeAt(offset: UtcOffset): DateTime
Converts this instant to the corresponding DateTime at offset.
fun Instant.toDateTimeAt(zone: TimeZone): DateTime
Converts this instant to the corresponding DateTime in zone.
toJavaInstant
Link copied to clipboard
fun Instant.toJavaInstant(): Instant
Converts this instant to an equivalent Java Instant.
truncatedTo
Link copied to clipboard
common
fun Instant.truncatedTo(unit: TimeUnit): Instant
Returns this instant, rounded down to match the precision of a given unit.
until
Link copied to clipboard
common
infix fun Instant.until(to: Instant): InstantInterval
Creates an InstantInterval from this instant up to, but not including to.