DateTimeUnit

sealed class DateTimeUnit

A unit for measuring time.

See the predefined constants for time units, like DateTimeUnit.NANOSECOND, DateTimeUnit.DAY, DateTimeUnit.MONTH, and others.

Two ways are provided to create custom DateTimeUnit instances:

  • By multiplying an existing unit on the right by an integer scalar: for example, DateTimeUnit.NANOSECOND * 10.

  • By constructing an instance manually with TimeBased, DayBased, or MonthBased: for example, TimeBased(nanoseconds = 10).

Note that a calendar day is not considered identical to 24 hours. See DateTimeUnit.DayBased for a discussion.

Types

Link copied to clipboard
object Companion
Link copied to clipboard
sealed class DateBased : DateTimeUnit

A date-time unit equal to some number of days or months.

Link copied to clipboard
class DayBased(val days: Int) : DateTimeUnit.DateBased

A date-time unit equal to some number of calendar days.

Link copied to clipboard
class MonthBased(val months: Int) : DateTimeUnit.DateBased

A date-time unit equal to some number of months.

Link copied to clipboard
class TimeBased(val nanoseconds: Long) : DateTimeUnit

A date-time unit that has the precise time duration.

Functions

Link copied to clipboard
abstract operator fun times(scalar: Int): DateTimeUnit

Produces a date-time unit that is a multiple of this unit times the specified integer scalar value.

Inheritors

Link copied to clipboard
Link copied to clipboard