until

actual fun Instant.until(other: Instant, unit: DateTimeUnit, timeZone: TimeZone): Long(source)

Returns the whole number of the specified time units between this and other instants.

The value returned is:

  • positive or zero if this instant is earlier than the other,

  • negative or zero if this instant is later than the other,

  • zero if this instant is equal to the other.

If the result does not fit in Long, returns Long.MAX_VALUE for a positive result or Long.MIN_VALUE for a negative result.


expect fun Instant.until(other: Instant, unit: DateTimeUnit, timeZone: TimeZone): Long(source)

Returns the whole number of the specified date or time units between this and other instants in the specified timeZone.

The value returned is:

  • positive or zero if this instant is earlier than the other,

  • negative or zero if this instant is later than the other,

  • zero if this instant is equal to the other.

If the result does not fit in Long, returns Long.MAX_VALUE for a positive result or Long.MIN_VALUE for a negative result.

Throws

if this or other instant is too large to fit in LocalDateTime.


Returns the whole number of the specified date units between this and other dates.

The value returned is:

  • positive or zero if this date is earlier than the other,

  • negative or zero if this date is later than the other,

  • zero if this date is equal to the other.

If the result does not fit in Int, returns Int.MAX_VALUE for a positive result or Int.MIN_VALUE for a negative result.

See also

actual fun Instant.until(other: Instant, unit: DateTimeUnit, timeZone: TimeZone): Long(source)
actual fun Instant.until(other: Instant, unit: DateTimeUnit, timeZone: TimeZone): Long(source)