Skip to content

//core/io.islandtime/between

between

common

fun Centuries.Companion.between(start: Year, endExclusive: Year): Centuries

Returns the number of whole centuries between two years.

common

fun Centuries.Companion.between(start: YearMonth, endExclusive: YearMonth): Centuries

Returns the number of whole centuries between two year-months.

common

fun Centuries.Companion.between(start: Date, endExclusive: Date): Centuries

Returns the number of whole centuries between two dates.

common

fun Centuries.Companion.between(start: DateTime, endExclusive: DateTime): Centuries

Returns the number of whole centuries between two date-times, which are assumed to be in the same time zone.

common

fun Centuries.Companion.between(start: OffsetDateTime, endExclusive: OffsetDateTime): Centuries

Returns the number of whole centuries between two date-times, adjusting the offset of endExclusive if necessary to match the starting date-time.

common

fun Centuries.Companion.between(start: ZonedDateTime, endExclusive: ZonedDateTime): Centuries

Returns the number of whole centuries between two date-times, adjusting the time zone of endExclusive if necessary to match the starting date-time.

common

fun Decades.Companion.between(start: Year, endExclusive: Year): Decades

Returns the number of whole decades between two years.

common

fun Decades.Companion.between(start: YearMonth, endExclusive: YearMonth): Decades

Returns the number of whole decades between two year-months.

common

fun Decades.Companion.between(start: Date, endExclusive: Date): Decades

Returns the number of whole decades between two dates.

common

fun Decades.Companion.between(start: DateTime, endExclusive: DateTime): Decades

Returns the number of whole decades between two date-times, which are assumed to be in the same time zone.

common

fun Decades.Companion.between(start: OffsetDateTime, endExclusive: OffsetDateTime): Decades

Returns the number of whole decades between two date-times, adjusting the offset of endExclusive if necessary to match the starting date-time.

common

fun Decades.Companion.between(start: ZonedDateTime, endExclusive: ZonedDateTime): Decades

Returns the number of whole decades between two date-times, adjusting the time zone of endExclusive if necessary to match the starting date-time.

common

fun Years.Companion.between(start: Year, endExclusive: Year): Years

Returns the number of years between two years.

common

fun Years.Companion.between(start: YearMonth, endExclusive: YearMonth): Years

Returns the number of whole years between two year-months.

common

fun Years.Companion.between(start: Date, endExclusive: Date): Years

Returns the number of whole years between two dates.

common

fun Years.Companion.between(start: DateTime, endExclusive: DateTime): Years

Returns the number of whole years between two date-times, which are assumed to be in the same time zone.

common

fun Years.Companion.between(start: OffsetDateTime, endExclusive: OffsetDateTime): Years

Returns the number of whole years between two date-times, adjusting the offset of endExclusive if necessary to match the starting date-time.

common

fun Years.Companion.between(start: ZonedDateTime, endExclusive: ZonedDateTime): Years

Returns the number of whole years between date-times, adjusting the time zone of endExclusive if necessary to match the starting date-time.

common

fun Months.Companion.between(start: YearMonth, endExclusive: YearMonth): Months

Returns the number of months between two year-months.

common

fun Months.Companion.between(start: Date, endExclusive: Date): Months

Returns the number of whole months between two dates.

common

fun Months.Companion.between(start: DateTime, endExclusive: DateTime): Months

Returns the number of whole months between two date-times, which are assumed to be in the same time zone.

common

fun Months.Companion.between(start: OffsetDateTime, endExclusive: OffsetDateTime): Months

Returns the number of whole months between two date-times, adjusting the offset of endExclusive if necessary to match the starting date-time.

common

fun Months.Companion.between(start: ZonedDateTime, endExclusive: ZonedDateTime): Months

Returns the number of whole months between two zoned date-times, adjusting the time zone of endExclusive if necessary to match the starting date-time.

common

fun Weeks.Companion.between(start: Date, endExclusive: Date): Weeks

Returns the number of whole weeks between two dates.

common

fun Weeks.Companion.between(start: DateTime, endExclusive: DateTime): Weeks

Returns the number whole weeks between two date-times, which are assumed to be in the same time zone.

common

fun Weeks.Companion.between(start: OffsetDateTime, endExclusive: OffsetDateTime): Weeks

Returns the number whole weeks between two date-times, adjusting the offset of endExclusive if necessary to match the starting date-time.

common

fun Weeks.Companion.between(start: ZonedDateTime, endExclusive: ZonedDateTime): Weeks

Returns the number of whole weeks between two zoned date-times, adjusting the time zone of endExclusive if necessary to match the starting date-time.

common

fun Days.Companion.between(start: Date, endExclusive: Date): Days

Returns the number of days between two dates.

common

fun Days.Companion.between(start: DateTime, endExclusive: DateTime): Days

Returns the number whole days between two date-times, which are assumed to be in the same time zone.

common

fun Days.Companion.between(start: OffsetDateTime, endExclusive: OffsetDateTime): Days

Returns the number whole days between two date-times, adjusting the offset of endExclusive if necessary to match the starting date-time.

common

fun Days.Companion.between(start: ZonedDateTime, endExclusive: ZonedDateTime): Days

Returns the number of whole days between two zoned date-times, adjusting the time zone of endExclusive if necessary to match the starting date-time.

common

fun Hours.Companion.between(start: DateTime, endExclusive: DateTime): Hours

Returns the number of whole hours between two date-times, which are assumed to be at the same UTC offset. In general, it's more appropriate to calculate duration using Instant or ZonedDateTime as any daylight savings rules won't be taken into account when working with DateTime directly.

common

fun Hours.Companion.between(start: TimePoint<*>, endExclusive: TimePoint<*>): Hours

Returns the number of whole hours between two time points.

common

fun Minutes.Companion.between(start: DateTime, endExclusive: DateTime): Minutes

Returns the number of whole minutes between two date-times, which are assumed to be at the same UTC offset. In general, it's more appropriate to calculate duration using Instant or ZonedDateTime as any daylight savings rules won't be taken into account when working with DateTime directly.

common

fun Minutes.Companion.between(start: TimePoint<*>, endExclusive: TimePoint<*>): Minutes

Returns the number of whole minutes between two time points.

common

fun Seconds.Companion.between(start: DateTime, endExclusive: DateTime): Seconds

Returns the number of whole seconds between two date-times, which are assumed to be at the same UTC offset. In general, it's more appropriate to calculate duration using Instant or ZonedDateTime as any daylight savings rules won't be taken into account when working with DateTime directly.

Throws

ArithmeticException if the result overflows

common

fun Seconds.Companion.between(start: TimePoint<*>, endExclusive: TimePoint<*>): Seconds

Returns the number of whole seconds between two time points.

Throws

ArithmeticException if the result overflows

common

fun Milliseconds.Companion.between(start: DateTime, endExclusive: DateTime): Milliseconds

Returns the number of whole milliseconds between two date-times, which are assumed to be at the same UTC offset. In general, it's more appropriate to calculate duration using Instant or ZonedDateTime as any daylight savings rules won't be taken into account when working with DateTime directly.

Throws

ArithmeticException if the result overflows

common

fun Milliseconds.Companion.between(start: TimePoint<*>, endExclusive: TimePoint<*>): Milliseconds

Returns the number of whole milliseconds between two time points.

Throws

ArithmeticException if the result overflows

common

fun Microseconds.Companion.between(start: DateTime, endExclusive: DateTime): Microseconds

Returns the number of whole microseconds between two date-times, which are assumed to be at the same UTC offset. In general, it's more appropriate to calculate duration using Instant or ZonedDateTime as any daylight savings rules won't be taken into account when working with DateTime directly.

Throws

ArithmeticException if the result overflows

common

fun Microseconds.Companion.between(start: TimePoint<*>, endExclusive: TimePoint<*>): Microseconds

Returns the number of whole microseconds between two time points.

Throws

ArithmeticException if the result overflows

common

fun Nanoseconds.Companion.between(start: DateTime, endExclusive: DateTime): Nanoseconds

Returns the number of nanoseconds between two date-times, which are assumed to be at the same UTC offset. In general, it's more appropriate to calculate duration using Instant or ZonedDateTime as any daylight savings rules won't be taken into account when working with DateTime directly.

Throws

ArithmeticException if the result overflows

common

fun Nanoseconds.Companion.between(start: TimePoint<*>, endExclusive: TimePoint<*>): Nanoseconds

Returns the number of nanoseconds between two time points.

Throws

ArithmeticException if the result overflows

common

fun Duration.Companion.between(start: DateTime, endExclusive: DateTime): Duration

Returns the Duration between two date-times, which are assumed to be at the same UTC offset. In general, it's more appropriate to calculate duration using Instant or ZonedDateTime as any daylight savings rules won't be taken into account when working with DateTime directly.

common

fun Duration.Companion.between(start: TimePoint<*>, endExclusive: TimePoint<*>): Duration

Returns the Duration between two time points.

common

fun Period.Companion.between(start: Date, endExclusive: Date): Period

Returns the Period between two dates.

common

fun Period.Companion.between(start: DateTime, endExclusive: DateTime): Period

Returns the Period between two date-times, which are assumed to be in the same time zone.

common

fun Period.Companion.between(start: OffsetDateTime, endExclusive: OffsetDateTime): Period

Returns the Period between two date-times, adjusting the offset of endExclusive if necessary to match the starting date-time.

common

fun Period.Companion.between(start: ZonedDateTime, endExclusive: ZonedDateTime): Period

Returns the Period between two zoned date-times, adjusting the time zone of endExclusive if necessary to match the starting date-time.