Skip to content

//core/io.islandtime/roundedDownToNearest

roundedDownToNearest

common

fun Time.roundedDownToNearest(increment: Hours): Time

fun OffsetTime.roundedDownToNearest(increment: Hours): OffsetTime

Returns this time, rounded down to the nearest hour that satisfies the increment.

The increment must multiply evenly into a 24-hour day.

common

fun Time.roundedDownToNearest(increment: Minutes): Time

fun OffsetTime.roundedDownToNearest(increment: Minutes): OffsetTime

Returns this time, rounded down to the nearest minute that satisfies the increment.

The increment must multiply evenly into an hour.

common

fun Time.roundedDownToNearest(increment: Seconds): Time

fun OffsetTime.roundedDownToNearest(increment: Seconds): OffsetTime

Returns this time, rounded down to the nearest second that satisfies the increment.

The increment must multiply evenly into a minute.

common

fun Time.roundedDownToNearest(increment: Milliseconds): Time

fun OffsetTime.roundedDownToNearest(increment: Milliseconds): OffsetTime

Returns this time, rounded down to the nearest millisecond that satisfies the increment.

The increment must multiply evenly into a second.

common

fun Time.roundedDownToNearest(increment: Microseconds): Time

fun OffsetTime.roundedDownToNearest(increment: Microseconds): OffsetTime

Returns this time, rounded down to the nearest microsecond that satisfies the increment.

The increment must multiply evenly into a second.

common

fun Time.roundedDownToNearest(increment: Nanoseconds): Time

fun OffsetTime.roundedDownToNearest(increment: Nanoseconds): OffsetTime

Returns this time, rounded down to the nearest nanosecond that satisfies the increment.

The increment must multiply evenly into a second.

common

fun DateTime.roundedDownToNearest(increment: Hours): DateTime

fun OffsetDateTime.roundedDownToNearest(increment: Hours): OffsetDateTime

Returns this date-time, rounded down to the nearest hour that satisfies the increment.

The increment must multiply evenly into a 24-hour day.

common

fun DateTime.roundedDownToNearest(increment: Minutes): DateTime

fun OffsetDateTime.roundedDownToNearest(increment: Minutes): OffsetDateTime

Returns this date-time, rounded down to the nearest minute that satisfies the increment.

The increment must multiply evenly into an hour.

common

fun DateTime.roundedDownToNearest(increment: Seconds): DateTime

fun OffsetDateTime.roundedDownToNearest(increment: Seconds): OffsetDateTime

Returns this date-time, rounded down to the nearest second that satisfies the increment.

The increment must multiply evenly into a minute.

common

fun DateTime.roundedDownToNearest(increment: Milliseconds): DateTime

fun OffsetDateTime.roundedDownToNearest(increment: Milliseconds): OffsetDateTime

Returns this date-time, rounded down to the nearest millisecond that satisfies the increment.

The increment must multiply evenly into a second.

common

fun DateTime.roundedDownToNearest(increment: Microseconds): DateTime

fun OffsetDateTime.roundedDownToNearest(increment: Microseconds): OffsetDateTime

Returns this date-time, rounded down to the nearest microsecond that satisfies the increment.

The increment must multiply evenly into a second.

common

fun DateTime.roundedDownToNearest(increment: Nanoseconds): DateTime

fun OffsetDateTime.roundedDownToNearest(increment: Nanoseconds): OffsetDateTime

Returns this date-time, rounded down to the nearest nanosecond that satisfies the increment.

The increment must multiply evenly into a second.

common

fun ZonedDateTime.roundedDownToNearest(increment: Hours): ZonedDateTime

Returns this date-time, rounded down to the nearest hour that satisfies the increment.

The increment must multiply evenly into a 24-hour day.

Due to daylight savings time transitions, there a few complexities to be aware of. If the new local time falls within a gap (meaning it doesn't exist), it will be adjusted forward by the length of the gap. If it falls within an overlap (meaning the local time exists twice), the offset will be retained if possible. Otherwise, the earlier offset will be used.

common

fun ZonedDateTime.roundedDownToNearest(increment: Minutes): ZonedDateTime

Returns this date-time, rounded down to the nearest minute that satisfies the increment.

The increment must multiply evenly into an hour.

Due to daylight savings time transitions, there a few complexities to be aware of. If the new local time falls within a gap (meaning it doesn't exist), it will be adjusted forward by the length of the gap. If it falls within an overlap (meaning the local time exists twice), the offset will be retained if possible. Otherwise, the earlier offset will be used.

common

fun ZonedDateTime.roundedDownToNearest(increment: Seconds): ZonedDateTime

Returns this date-time, rounded down to the nearest second that satisfies the increment.

The increment must multiply evenly into a minute.

Due to daylight savings time transitions, there a few complexities to be aware of. If the new local time falls within a gap (meaning it doesn't exist), it will be adjusted forward by the length of the gap. If it falls within an overlap (meaning the local time exists twice), the offset will be retained if possible. Otherwise, the earlier offset will be used.

common

fun ZonedDateTime.roundedDownToNearest(increment: Milliseconds): ZonedDateTime

Returns this date-time, rounded down to the nearest millisecond that satisfies the increment.

The increment must multiply evenly into a second.

Due to daylight savings time transitions, there a few complexities to be aware of. If the new local time falls within a gap (meaning it doesn't exist), it will be adjusted forward by the length of the gap. If it falls within an overlap (meaning the local time exists twice), the offset will be retained if possible. Otherwise, the earlier offset will be used.

common

fun ZonedDateTime.roundedDownToNearest(increment: Microseconds): ZonedDateTime

Returns this date-time, rounded down to the nearest microsecond that satisfies the increment.

The increment must multiply evenly into a second.

Due to daylight savings time transitions, there a few complexities to be aware of. If the new local time falls within a gap (meaning it doesn't exist), it will be adjusted forward by the length of the gap. If it falls within an overlap (meaning the local time exists twice), the offset will be retained if possible. Otherwise, the earlier offset will be used.

common

fun ZonedDateTime.roundedDownToNearest(increment: Nanoseconds): ZonedDateTime

Returns this date-time, rounded down to the nearest nanosecond that satisfies the increment.

The increment must multiply evenly into a second.

Due to daylight savings time transitions, there a few complexities to be aware of. If the new local time falls within a gap (meaning it doesn't exist), it will be adjusted forward by the length of the gap. If it falls within an overlap (meaning the local time exists twice), the offset will be retained if possible. Otherwise, the earlier offset will be used.

common

fun Instant.roundedDownToNearest(increment: Hours): Instant

Returns this instant, rounded down to the nearest hour that satisfies the increment.

The increment must multiply evenly into a 24-hour day.

common

fun Instant.roundedDownToNearest(increment: Minutes): Instant

Returns this instant, rounded down to the nearest minute that satisfies the increment.

The increment must multiply evenly into an hour.

common

fun Instant.roundedDownToNearest(increment: Seconds): Instant

Returns this instant, rounded down to the nearest second that satisfies the increment.

The increment must multiply evenly into a minute.

common

fun Instant.roundedDownToNearest(increment: Milliseconds): Instant

Returns this instant, rounded down to the nearest millisecond that satisfies the increment.

The increment must multiply evenly into a second.

common

fun Instant.roundedDownToNearest(increment: Microseconds): Instant

Returns this instant, rounded down to the nearest microsecond that satisfies the increment.

The increment must multiply evenly into a second.

common

fun Instant.roundedDownToNearest(increment: Nanoseconds): Instant

Returns this instant, rounded down to the nearest nanosecond that satisfies the increment.

The increment must multiply evenly into a second.