minus

fun Instant.minus(period: DateTimePeriod, timeZone: TimeZone): Instant

Returns an instant that is the result of subtracting components of DateTimePeriod from this instant. The components are subtracted in the order from the largest units to the smallest, i.e. from years to nanoseconds.

Throws

if this value or the results of intermediate computations are too large to fit in LocalDateTime.


fun Instant.minus(other: Instant, timeZone: TimeZone): DateTimePeriod

Returns a DateTimePeriod representing the difference between other and this instants.

The components of DateTimePeriod are calculated so that adding it back to the other instant results in this instant.

All components of the DateTimePeriod returned are:

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

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

  • exactly zero if this instant is equal to the other.

See also

Throws

if this or other instant is too large to fit in LocalDateTime. Or (only on the JVM) if the number of months between the two dates exceeds an Int.


fun Instant.minus(unit: DateTimeUnit, timeZone: TimeZone): Instant

Returns an instant that is the result of subtracting one unit from this instant in the specified timeZone.

The returned instant is earlier than this instant.

Throws

if this value or the result is too large to fit in LocalDateTime.


fun Instant.minus(unit: DateTimeUnit.TimeBased): Instant

Returns an instant that is the result of subtracting one unit from this instant.

The returned instant is earlier than this instant.

The return value is clamped to the platform-specific boundaries for Instant if the result exceeds them.


fun Instant.minus(value: Int, unit: DateTimeUnit.TimeBased): Instant
fun Instant.minus(value: Long, unit: DateTimeUnit.TimeBased): Instant

Returns an instant that is the result of subtracting the value number of the specified unit from this instant.

If the value is positive, the returned instant is earlier than this instant. If the value is negative, the returned instant is later than this instant.

The return value is clamped to the platform-specific boundaries for Instant if the result exceeds them.


fun Instant.minus(    value: Long,     unit: DateTimeUnit,     timeZone: TimeZone): Instant
expect fun Instant.minus(    value: Int,     unit: DateTimeUnit,     timeZone: TimeZone): Instant

Returns an instant that is the result of subtracting the value number of the specified unit from this instant in the specified timeZone.

If the value is positive, the returned instant is earlier than this instant. If the value is negative, the returned instant is later than this instant.

Throws

if this value or the result is too large to fit in LocalDateTime.


fun Instant.minus(    other: Instant,     unit: DateTimeUnit,     timeZone: TimeZone): Long

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

The value returned is negative or zero if this instant is earlier than the other, and positive or zero if this instant is later than 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.

See also

Throws

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


fun Instant.minus(other: Instant, unit: DateTimeUnit.TimeBased): Long

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

The value returned is negative or zero if this instant is earlier than the other, and positive or zero if this instant is later than 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.

See also


operator fun LocalDate.minus(period: DatePeriod): LocalDate

Returns a date that is the result of subtracting components of DatePeriod from this date. The components are subtracted in the order from the largest units to the smallest, i.e. from years to days.

See also

Throws

if this value or the results of intermediate computations are too large to fit in LocalDate.


operator fun LocalDate.minus(other: LocalDate): DatePeriod

Returns a DatePeriod representing the difference between other and this dates.

The components of DatePeriod are calculated so that adding it back to the other date results in this date.

All components of the DatePeriod returned are:

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

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

  • exactly zero if this date is equal to the other.

See also

Throws

if the number of months between the two dates exceeds an Int (JVM only).


fun LocalDate.minus(unit: DateTimeUnit.DateBased): LocalDate

Returns a LocalDate that is the result of subtracting one unit from this date.

The returned date is earlier than this date.

Throws

if the result exceeds the boundaries of LocalDate.


fun LocalDate.minus(value: Long, unit: DateTimeUnit.DateBased): LocalDate
expect fun LocalDate.minus(value: Int, unit: DateTimeUnit.DateBased): LocalDate

Returns a LocalDate that is the result of subtracting the value number of the specified unit from this date.

If the value is positive, the returned date is earlier than this date. If the value is negative, the returned date is later than this date.

Throws

if the result exceeds the boundaries of LocalDate.

actual fun Instant.minus(    value: Int,     unit: DateTimeUnit,     timeZone: TimeZone): Instant
actual fun LocalDate.minus(value: Int, unit: DateTimeUnit.DateBased): LocalDate
actual fun Instant.minus(    value: Int,     unit: DateTimeUnit,     timeZone: TimeZone): Instant
actual fun LocalDate.minus(value: Int, unit: DateTimeUnit.DateBased): LocalDate
actual fun Instant.minus(    value: Int,     unit: DateTimeUnit,     timeZone: TimeZone): Instant
actual fun LocalDate.minus(value: Int, unit: DateTimeUnit.DateBased): LocalDate