Package-level declarations

Types

Link copied to clipboard
interface Clock

A source of Instant values.

Link copied to clipboard

A special case of DateTimePeriod that only stores the date components and has all time components equal to zero.

Link copied to clipboard

Thrown by date-time arithmetic operations if the result cannot be computed or represented.

Link copied to clipboard
sealed class DateTimePeriod

A difference between two instants, decomposed into date and time components.

Link copied to clipboard
@Serializable(with = DateTimeUnitSerializer::class)
sealed class DateTimeUnit

A unit for measuring time; for example, a second, 20 seconds, a day, a month, or a quarter.

Link copied to clipboard
actual enum DayOfWeek : Enum<DayOfWeek>
expect enum DayOfWeek : Enum<DayOfWeek>

The enumeration class representing the days of the week.

actual typealias DayOfWeek = java.time.DayOfWeek
actual enum DayOfWeek : Enum<DayOfWeek>
Link copied to clipboard

A time zone that is known to always have the same offset from UTC.

Link copied to clipboard

Thrown when attempting to construct a TimeZone with an invalid ID or unavailable rules.

Link copied to clipboard
@Serializable(with = InstantIso8601Serializer::class)
actual class Instant : Comparable<Instant>
@Serializable(with = InstantIso8601Serializer::class)
expect class Instant : Comparable<Instant>

A moment in time.

@Serializable(with = InstantIso8601Serializer::class)
actual class Instant : Comparable<Instant>
@Serializable(with = InstantIso8601Serializer::class)
actual class Instant : Comparable<Instant>
Link copied to clipboard
@Serializable(with = LocalDateIso8601Serializer::class)
actual class LocalDate(year: Int, monthNumber: Int, dayOfMonth: Int) : Comparable<LocalDate>
@Serializable(with = LocalDateIso8601Serializer::class)
expect class LocalDate(year: Int, monthNumber: Int, dayOfMonth: Int) : Comparable<LocalDate>

The date part of LocalDateTime.

@Serializable(with = LocalDateIso8601Serializer::class)
actual class LocalDate(year: Int, monthNumber: Int, dayOfMonth: Int) : Comparable<LocalDate>
@Serializable(with = LocalDateIso8601Serializer::class)
actual class LocalDate(val year: Int, val monthNumber: Int, val dayOfMonth: Int) : Comparable<LocalDate>
Link copied to clipboard

The representation of a specific civil date and time without a reference to a particular time zone.

actual class LocalDateTime(val date: LocalDate, val time: LocalTime) : Comparable<LocalDateTime>
Link copied to clipboard
@Serializable(with = LocalTimeIso8601Serializer::class)
actual class LocalTime(hour: Int, minute: Int, second: Int, nanosecond: Int) : Comparable<LocalTime>
@Serializable(with = LocalTimeIso8601Serializer::class)
expect class LocalTime(hour: Int, minute: Int, second: Int = 0, nanosecond: Int = 0) : Comparable<LocalTime>

The time part of LocalDateTime.

@Serializable(with = LocalTimeIso8601Serializer::class)
actual class LocalTime(hour: Int, minute: Int, second: Int, nanosecond: Int) : Comparable<LocalTime>
@Serializable(with = LocalTimeIso8601Serializer::class)
actual class LocalTime(val hour: Int, val minute: Int, val second: Int, val nanosecond: Int) : Comparable<LocalTime>
Link copied to clipboard
actual enum Month : Enum<Month>
expect enum Month : Enum<Month>

The enumeration class representing the 12 months of the year.

actual typealias Month = java.time.Month
actual enum Month : Enum<Month>
Link copied to clipboard
@Serializable(with = TimeZoneSerializer::class)
actual open class TimeZone
@Serializable(with = TimeZoneSerializer::class)
expect open class TimeZone

A time zone, provides the conversion between Instant and LocalDateTime values using a collection of rules specifying which LocalDateTime value corresponds to each Instant.

@Serializable(with = TimeZoneSerializer::class)
actual open class TimeZone
@Serializable(with = TimeZoneSerializer::class)
actual open class TimeZone
Link copied to clipboard
@Serializable(with = UtcOffsetSerializer::class)
actual class UtcOffset
@Serializable(with = UtcOffsetSerializer::class)
expect class UtcOffset

An offset from UTC.

@Serializable(with = UtcOffsetSerializer::class)
actual class UtcOffset(zoneOffset: ZoneOffset)
@Serializable(with = UtcOffsetSerializer::class)
actual class UtcOffset

Properties

Link copied to clipboard

Returns true if the instant is Instant.DISTANT_FUTURE or later.

Link copied to clipboard

Returns true if the instant is Instant.DISTANT_PAST or earlier.

Link copied to clipboard

The ISO 8601 number of the given day of the week. Monday is 1, Sunday is 7.

Link copied to clipboard

The number of the Month. January is 1, December is 12.

Functions

Link copied to clipboard

Returns a TimeSource that uses this Clock to mark a time instant and to find the amount of time elapsed since that mark.

Link copied to clipboard

Returns the fixed-offset time zone with the given UTC offset.

Link copied to clipboard

Combines this time's components with the specified LocalDate components into a LocalDateTime value.

fun LocalTime.atDate(year: Int, monthNumber: Int, dayOfMonth: Int = 0): LocalDateTime
fun LocalTime.atDate(year: Int, month: Month, dayOfMonth: Int = 0): LocalDateTime

Combines this time's components with the specified date components into a LocalDateTime value.

Link copied to clipboard
actual fun LocalDate.atStartOfDayIn(timeZone: TimeZone): Instant
expect fun LocalDate.atStartOfDayIn(timeZone: TimeZone): Instant

Returns an instant that corresponds to the start of this date in the specified timeZone.

actual fun LocalDate.atStartOfDayIn(timeZone: TimeZone): Instant
actual fun LocalDate.atStartOfDayIn(timeZone: TimeZone): Instant
Link copied to clipboard

Combines this date's components with the specified LocalTime components into a LocalDateTime value.

fun LocalDate.atTime(hour: Int, minute: Int, second: Int = 0, nanosecond: Int = 0): LocalDateTime

Combines this date's components with the specified time components into a LocalDateTime value.

Link copied to clipboard
fun DateTimePeriod(years: Int = 0, months: Int = 0, days: Int = 0, hours: Int = 0, minutes: Int = 0, seconds: Int = 0, nanoseconds: Long = 0): DateTimePeriod

Constructs a new DateTimePeriod. If all the time components are zero, returns a DatePeriod.

Link copied to clipboard
fun DayOfWeek(isoDayNumber: Int): DayOfWeek

Returns the DayOfWeek instance for the given ISO 8601 week day number. Monday is 1, Sunday is 7.

Link copied to clipboard
actual fun LocalDate.daysUntil(other: LocalDate): Int
expect fun LocalDate.daysUntil(other: LocalDate): Int

Returns the number of whole days between two dates.

fun Instant.daysUntil(other: Instant, timeZone: TimeZone): Int

Returns the number of whole days between two instants in the specified timeZone.

actual fun LocalDate.daysUntil(other: LocalDate): Int
actual fun LocalDate.daysUntil(other: LocalDate): Int
Link copied to clipboard

Formats this value using the given format. Equivalent to calling DateTimeFormat.format on format with this.

fun Instant.format(format: DateTimeFormat<DateTimeComponents>, offset: UtcOffset = UtcOffset.ZERO): String

Formats this value using the given format using the given offset.

Link copied to clipboard
actual fun Instant.minus(value: Int, unit: DateTimeUnit, timeZone: TimeZone): Instant
operator fun LocalDate.minus(period: DatePeriod): LocalDate

Returns a date that results from subtracting components of DatePeriod from this date. The components are subtracted in the order from the largest units to the smallest: first years and months, then days.

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

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

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

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.

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

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

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

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

expect fun Instant.minus(value: Int, unit: DateTimeUnit, timeZone: TimeZone): Instant
fun Instant.minus(value: Long, 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.

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.

actual fun Instant.minus(value: Int, unit: DateTimeUnit, timeZone: TimeZone): Instant
actual fun Instant.minus(value: Int, unit: DateTimeUnit, timeZone: TimeZone): Instant
Link copied to clipboard
fun Month(number: Int): Month

Returns the Month instance for the given month number. January is 1, December is 12.

Link copied to clipboard
actual fun LocalDate.monthsUntil(other: LocalDate): Int
expect fun LocalDate.monthsUntil(other: LocalDate): Int

Returns the number of whole months between two dates.

fun Instant.monthsUntil(other: Instant, timeZone: TimeZone): Int

Returns the number of whole months between two instants in the specified timeZone.

actual fun LocalDate.monthsUntil(other: LocalDate): Int
actual fun LocalDate.monthsUntil(other: LocalDate): Int
Link copied to clipboard
actual fun TimeZone.offsetAt(instant: Instant): UtcOffset
expect fun TimeZone.offsetAt(instant: Instant): UtcOffset

Finds the offset from UTC this time zone has at the specified instant of physical time.

actual fun TimeZone.offsetAt(instant: Instant): UtcOffset
actual fun TimeZone.offsetAt(instant: Instant): UtcOffset
Link copied to clipboard

Finds the offset from UTC the specified timeZone has at this instant of physical time.

Link copied to clipboard
actual fun Instant.periodUntil(other: Instant, timeZone: TimeZone): DateTimePeriod

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

expect fun Instant.periodUntil(other: Instant, timeZone: TimeZone): DateTimePeriod

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

actual fun Instant.periodUntil(other: Instant, timeZone: TimeZone): DateTimePeriod
actual fun Instant.periodUntil(other: Instant, timeZone: TimeZone): DateTimePeriod
Link copied to clipboard
actual operator fun LocalDate.plus(period: DatePeriod): LocalDate
actual fun Instant.plus(value: Long, unit: DateTimeUnit.TimeBased): Instant
actual fun Instant.plus(period: DateTimePeriod, timeZone: TimeZone): Instant
actual fun Instant.plus(value: Int, unit: DateTimeUnit, timeZone: TimeZone): Instant
actual fun Instant.plus(value: Long, unit: DateTimeUnit, timeZone: TimeZone): Instant
operator fun DatePeriod.plus(other: DatePeriod): DatePeriod

Adds two DatePeriod instances.

Adds two DateTimePeriod instances.

expect operator fun LocalDate.plus(period: DatePeriod): LocalDate

Returns a date that results from adding components of DatePeriod to this date. The components are added in the order from the largest units to the smallest: first years and months, then days.

expect fun Instant.plus(value: Long, unit: DateTimeUnit.TimeBased): Instant

Returns an instant that is the result of adding the value number of the specified unit to this instant.

expect fun Instant.plus(period: DateTimePeriod, timeZone: TimeZone): Instant

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

Returns a LocalDate that results from adding the value number of the specified unit to this date.

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

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

actual operator fun LocalDate.plus(period: DatePeriod): LocalDate
actual fun Instant.plus(value: Long, unit: DateTimeUnit.TimeBased): Instant
actual fun Instant.plus(period: DateTimePeriod, timeZone: TimeZone): Instant
actual fun Instant.plus(value: Int, unit: DateTimeUnit, timeZone: TimeZone): Instant
actual fun Instant.plus(value: Long, unit: DateTimeUnit, timeZone: TimeZone): Instant
actual operator fun LocalDate.plus(period: DatePeriod): LocalDate
actual fun Instant.plus(value: Long, unit: DateTimeUnit.TimeBased): Instant
actual fun Instant.plus(period: DateTimePeriod, timeZone: TimeZone): Instant
actual fun Instant.plus(value: Int, unit: DateTimeUnit, timeZone: TimeZone): Instant
actual fun Instant.plus(value: Long, unit: DateTimeUnit, timeZone: TimeZone): Instant
Link copied to clipboard
Link copied to clipboard

Returns the current date at the given time zone, according to this Clock.

Link copied to clipboard
actual fun LocalDateTime.toInstant(timeZone: TimeZone): Instant
expect fun LocalDateTime.toInstant(timeZone: TimeZone): Instant

Returns an instant that corresponds to this civil date/time value in the specified timeZone.

Returns an instant that corresponds to this civil date/time value that happens at the specified UTC offset.

actual fun LocalDateTime.toInstant(timeZone: TimeZone): Instant
actual fun LocalDateTime.toInstant(timeZone: TimeZone): Instant
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Converts the Instant to an instance of JS Date.

Link copied to clipboard
Link copied to clipboard
fun <Error class: unknown class>.toKotlinInstant(): Instant

Converts the NSDate to the corresponding Instant.

Converts the JS Date to the corresponding Instant.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <Error class: unknown class>.toKotlinTimeZone(): TimeZone

Converts the NSTimeZone to the corresponding TimeZone.

Link copied to clipboard
Link copied to clipboard

Returns a civil date/time value that this instant has in the specified timeZone.

Link copied to clipboard
fun Instant.toNSDate(): <Error class: unknown class>

Converts the Instant to an instance of NSDate.

Link copied to clipboard
fun LocalDate.toNSDateComponents(): <Error class: unknown class>
fun LocalDateTime.toNSDateComponents(): <Error class: unknown class>

Converts the given LocalDate to NSDateComponents.

Link copied to clipboard
fun TimeZone.toNSTimeZone(): <Error class: unknown class>

Converts the TimeZone to NSTimeZone.

Link copied to clipboard
actual fun Instant.until(other: Instant, unit: DateTimeUnit, timeZone: TimeZone): Long

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

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

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

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

actual fun Instant.until(other: Instant, unit: DateTimeUnit, timeZone: TimeZone): Long
actual fun Instant.until(other: Instant, unit: DateTimeUnit, timeZone: TimeZone): Long
Link copied to clipboard
actual fun UtcOffset(hours: Int? = null, minutes: Int? = null, seconds: Int? = null): UtcOffset
expect fun UtcOffset(hours: Int? = null, minutes: Int? = null, seconds: Int? = null): UtcOffset

Constructs a UtcOffset from hours, minutes, and seconds components.

actual fun UtcOffset(hours: Int? = null, minutes: Int? = null, seconds: Int? = null): UtcOffset
actual fun UtcOffset(hours: Int? = null, minutes: Int? = null, seconds: Int? = null): UtcOffset
Link copied to clipboard
actual fun LocalDate.yearsUntil(other: LocalDate): Int
expect fun LocalDate.yearsUntil(other: LocalDate): Int

Returns the number of whole years between two dates.

fun Instant.yearsUntil(other: Instant, timeZone: TimeZone): Int

Returns the number of whole years between two instants in the specified timeZone.

actual fun LocalDate.yearsUntil(other: LocalDate): Int
actual fun LocalDate.yearsUntil(other: LocalDate): Int