Instant¶
common
@Serializable(with = InstantIsoSerializer::class)
class Instant : TimePoint<Instant> , Comparable<Instant>
An instant in time with nanosecond-precision.
Types¶
| Name | Summary |
|---|---|
| Companion | common object Companion |
Properties¶
| Name | Summary |
|---|---|
| additionalNanosecondsSinceUnixEpoch | common open val additionalNanosecondsSinceUnixEpoch: NanosecondsThe number of additional nanoseconds on top of secondsSinceUnixEpoch. |
| millisecondOfUnixEpoch | common open override val millisecondOfUnixEpoch: LongThe millisecond of the Unix epoch. |
| millisecondsSinceUnixEpoch | common open override val millisecondsSinceUnixEpoch: MillisecondsThe number of milliseconds since the Unix epoch of 1970-01-01T00:00Z. |
| nanosecond | common open override val nanosecond: IntThe nanosecond of the second. |
| secondOfUnixEpoch | common open override val secondOfUnixEpoch: LongThe second of the Unix epoch. |
| secondsSinceUnixEpoch | common open val secondsSinceUnixEpoch: SecondsThe number of seconds since the Unix epoch of 1970-01-01T00:00Z. |
Functions¶
| Name | Summary |
|---|---|
| at | common infix fun Instant.at(zone: TimeZone): ZonedDateTimeCombines an instant with a time zone to create a ZonedDateTime. common infix fun Instant.at(offset: UtcOffset): OffsetDateTimeCombines an instant with a UTC offset to create an OffsetDateTime. |
| compareTo | common open operator override fun compareTo(other: Instant): Intcommon open operator fun compareTo(other: TimePoint<*>): IntCompares this time point with another time point. |
| equals | common open operator override fun equals(other: Any?): Boolean |
| hashCode | common open override fun hashCode(): Int |
| isSameInstantAs | common open fun isSameInstantAs(other: TimePoint<*>): BooleanChecks if this time point represents the same instant as other. Unlike the equals operator, equality is determined solely by timeline order. |
| minus | common operator fun minus(days: Days): InstantReturns this instant with a number of 24-hour days subtracted from it. common operator fun minus(other: Duration): Instantcommon open operator override fun minus(hours: Hours): InstantReturns this instant with hours subtracted from it. common open operator override fun minus(microseconds: Microseconds): InstantReturns this instant with microseconds subtracted from it. common open operator override fun minus(milliseconds: Milliseconds): InstantReturns this instant with milliseconds subtracted from it. common open operator override fun minus(minutes: Minutes): InstantReturns this instant with minutes subtracted from it. common open operator override fun minus(nanoseconds: Nanoseconds): InstantReturns this instant with nanoseconds subtracted from it. common open operator override fun minus(seconds: Seconds): InstantReturns this instant with seconds subtracted from it. common operator fun minus(duration: Duration): InstantReturns this instant with duration subtracted from it. |
| plus | common operator fun plus(days: Days): InstantReturns this instant with a number of 24-hour days added to it. common operator fun plus(other: Duration): Instantcommon open operator override fun plus(hours: Hours): InstantReturns this instant with hours added to it. common open operator override fun plus(microseconds: Microseconds): InstantReturns this instant with microseconds added to it. common open operator override fun plus(milliseconds: Milliseconds): InstantReturns this instant with milliseconds added to it. common open operator override fun plus(minutes: Minutes): InstantReturns this instant with minutes added to it. common open operator override fun plus(nanoseconds: Nanoseconds): InstantReturns this instant with nanoseconds added to it. common open operator override fun plus(seconds: Seconds): InstantReturns this instant with seconds added to it. common operator fun plus(duration: Duration): InstantReturns this instant with duration added to it. |
| rangeTo | common operator fun rangeTo(other: Instant): InstantInterval |
| roundedDownTo | common fun Instant.roundedDownTo(unit: TimeUnit): InstantReturns this instant, rounded down to match the precision of a given unit. |
| roundedDownToNearest | common fun Instant.roundedDownToNearest(increment: Hours): InstantReturns this instant, rounded down to the nearest hour that satisfies the increment. common fun Instant.roundedDownToNearest(increment: Microseconds): InstantReturns this instant, rounded down to the nearest microsecond that satisfies the increment. common fun Instant.roundedDownToNearest(increment: Milliseconds): InstantReturns this instant, rounded down to the nearest millisecond that satisfies the increment. common fun Instant.roundedDownToNearest(increment: Minutes): InstantReturns this instant, rounded down to the nearest minute that satisfies the increment. common fun Instant.roundedDownToNearest(increment: Nanoseconds): InstantReturns this instant, rounded down to the nearest nanosecond that satisfies the increment. common fun Instant.roundedDownToNearest(increment: Seconds): InstantReturns this instant, rounded down to the nearest second that satisfies the increment. |
| roundedTo | common fun Instant.roundedTo(unit: TimeUnit): InstantReturns this instant, rounded to match the precision of a given unit. If the time is halfway between whole values of the unit, it will be rounded up. |
| roundedToNearest | common fun Instant.roundedToNearest(increment: Hours): InstantReturns this instant, rounded to the nearest hour that satisfies the increment. If the time is halfway between increments, it will be rounded up. common fun Instant.roundedToNearest(increment: Microseconds): InstantReturns this instant, rounded to the nearest microsecond that satisfies the increment. If the time is halfway between increments, it will be rounded up. common fun Instant.roundedToNearest(increment: Milliseconds): InstantReturns this instant, rounded to the nearest millisecond that satisfies the increment. If the time is halfway between increments, it will be rounded up. common fun Instant.roundedToNearest(increment: Minutes): InstantReturns this instant, rounded to the nearest minute that satisfies the increment. If the time is halfway between increments, it will be rounded up. common fun Instant.roundedToNearest(increment: Nanoseconds): InstantReturns this instant, rounded to the nearest nanosecond that satisfies the increment. If the time is halfway between increments, it will be rounded up. common fun Instant.roundedToNearest(increment: Seconds): InstantReturns this instant, rounded to the nearest second that satisfies the increment. If the time is halfway between increments, it will be rounded up. |
| roundedUpTo | common fun Instant.roundedUpTo(unit: TimeUnit): InstantReturns this instant, rounded up to match the precision of a given unit. |
| roundedUpToNearest | common fun Instant.roundedUpToNearest(increment: Hours): InstantReturns this instant, rounded up to the nearest hour that satisfies the increment. common fun Instant.roundedUpToNearest(increment: Microseconds): InstantReturns this instant, rounded up to the nearest microsecond that satisfies the increment. common fun Instant.roundedUpToNearest(increment: Milliseconds): InstantReturns this instant, rounded up to the nearest millisecond that satisfies the increment. common fun Instant.roundedUpToNearest(increment: Minutes): InstantReturns this instant, rounded up to the nearest minute that satisfies the increment. common fun Instant.roundedUpToNearest(increment: Nanoseconds): InstantReturns this instant, rounded up to the nearest nanosecond that satisfies the increment. common fun Instant.roundedUpToNearest(increment: Seconds): InstantReturns this instant, rounded up to the nearest second that satisfies the increment. |
| toDateAt | common fun Instant.toDateAt(zone: TimeZone): DateConverts this instant to the corresponding Date in zone. common fun Instant.toDateAt(offset: UtcOffset): DateConverts this instant to the corresponding Date at offset. |
| toDateTimeAt | common fun Instant.toDateTimeAt(zone: TimeZone): DateTimeConverts this instant to the corresponding DateTime in zone. common fun Instant.toDateTimeAt(offset: UtcOffset): DateTimeConverts this instant to the corresponding DateTime at offset. |
| toJavaInstant | jvm fun Instant.toJavaInstant(): InstantConverts this instant to an equivalent Java Instant. |
| toNSDate | darwin fun <T> TimePoint<T>.toNSDate(): <Error class: unknown class>Converts this time point to an NSDate. |
| toString | common open override fun toString(): StringConverts this instant to a string in ISO-8601 extended format. For example, 2020-02-13T02:30:05.367Z. |
| truncatedTo | common fun Instant.truncatedTo(unit: TimeUnit): InstantReturns this instant, rounded down to match the precision of a given unit. |
| until | common infix fun Instant.until(to: Instant): InstantIntervalCreates an InstantInterval from this instant up to, but not including to. |