Package-level declarations

Types

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 datetime arithmetic operations if the result cannot be computed or represented.

Link copied to clipboard
@Serializable(with = DateTimePeriodSerializer::class)
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

The enumeration class representing the days of the week.

Link copied to clipboard

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

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

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 = LocalDateSerializer::class)
actual class LocalDate : Comparable<LocalDate>

The date part of LocalDateTime.

@Serializable(with = LocalDateSerializer::class)
expect class LocalDate : Comparable<LocalDate>

The date part of LocalDateTime.

The date part of LocalDateTime.

Link copied to clipboard

A progression of values of type LocalDate.

Link copied to clipboard

A range of values of type LocalDate.

Link copied to clipboard
@Serializable(with = LocalDateTimeSerializer::class)
actual class LocalDateTime(val date: LocalDate, val time: LocalTime) : Comparable<LocalDateTime>

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

@Serializable(with = LocalDateTimeSerializer::class)
expect class LocalDateTime(date: LocalDate, time: LocalTime) : Comparable<LocalDateTime>

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

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

Link copied to clipboard

The date part of a LocalDateTime, represented using the ISO week calendar.

Link copied to clipboard
@Serializable(with = LocalTimeSerializer::class)
actual class LocalTime : Comparable<LocalTime>

The time part of LocalDateTime.

@Serializable(with = LocalTimeSerializer::class)
expect class LocalTime : Comparable<LocalTime>

The time part of LocalDateTime.

The time part of LocalDateTime.

Link copied to clipboard
enum Month : Enum<Month>

The enumeration class representing the 12 months of the year.

Link copied to clipboard
actual 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.

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.

actual 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.

Link copied to clipboard
@Serializable(with = UtcOffsetSerializer::class)
actual class UtcOffset

An offset from UTC.

@Serializable(with = UtcOffsetSerializer::class)
expect class UtcOffset

An offset from UTC.

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

An offset from UTC.

Link copied to clipboard
@Serializable(with = YearMonthSerializer::class)
actual class YearMonth(val year: Int, month: Int) : Comparable<YearMonth>

The year-month part of LocalDate, without a day-of-month.

@Serializable(with = YearMonthSerializer::class)
expect class YearMonth(year: Int, month: Int) : Comparable<YearMonth>

The year-month part of LocalDate, without a day-of-month.

@Serializable(with = YearMonthSerializer::class)
actual class YearMonth(year: Int, month: Int) : Comparable<YearMonth> , Serializable

The year-month part of LocalDate, without a day-of-month.

Link copied to clipboard

A progression of values of type YearMonth.

Link copied to clipboard

A range of values of type YearMonth.

Properties

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.

Link copied to clipboard

Returns the year-month part of this date.

Functions

Link copied to clipboard

Creates a Clock that uses the time mark at the moment of creation to determine how far the current moment is from the origin.

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, month: Int, day: Int): LocalDateTime
fun LocalTime.atDate(year: Int, month: Month, day: Int): 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, youShallNotPass: OverloadMarker): Instant

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

expect fun LocalDate.atStartOfDayIn(timeZone: TimeZone, youShallNotPass: OverloadMarker = OverloadMarker.INSTANCE): Instant

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

actual fun LocalDate.atStartOfDayIn(timeZone: TimeZone, youShallNotPass: OverloadMarker): Instant

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

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 weekday number. Monday is 1, and Sunday is 7.

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

Returns the number of whole days between two dates.

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

Returns the number of whole days between two dates.

Link copied to clipboard

Creates a LocalDateProgression from this down to that, inclusive.

Creates a YearMonthProgression from this down to that, inclusive.

Link copied to clipboard
Link copied to clipboard

Returns the first LocalDate of the LocalDateProgression, or null if the progression is empty.

Returns the first YearMonth of the YearMonthProgression, or null if the progression is empty.

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
Link copied to clipboard

Returns the last LocalDate of the LocalDateProgression, or null if the progression is empty.

Returns the last YearMonth of the YearMonthProgression, or null if the progression is empty.

Link copied to clipboard
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.

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.

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 a LocalDate that results from subtracting the value number of the specified unit from this date.

Returns a YearMonth that results from subtracting the value number of the specified unit from this year-month.

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.

Link copied to clipboard

The YearMonth one month earlier.

Link copied to clipboard

The YearMonth 12 months earlier.

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

Returns the number of whole months between two dates.

expect fun LocalDate.monthsUntil(other: LocalDate): Int

Returns the number of whole months between two dates.

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

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

Returns the number of whole months between two dates.

Link copied to clipboard

Returns a LocalDate that has the given dayOfWeek later than this date.

Link copied to clipboard

Returns a LocalDate that has the given dayOfWeek not earlier than this date.

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

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

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

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

Link copied to clipboard

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

Link copied to clipboard

Combines this year-month with the specified day-of-month into a LocalDate value.

Link copied to clipboard
Link copied to clipboard
fun Instant.Companion.parseOrNull(input: CharSequence, format: DateTimeFormat<DateTimeComponents> = DateTimeComponents.Formats.ISO_DATE_TIME_OFFSET): Instant?

A shortcut for calling DateTimeFormat.parseOrNull, followed by DateTimeComponents.toInstantUsingOffset, returning null if any of the two operations fail.

expect fun LocalDate.Companion.parseOrNull(input: CharSequence, format: DateTimeFormat<LocalDate> = getIsoDateFormat()): LocalDate?
expect fun LocalDateTime.Companion.parseOrNull(input: CharSequence, format: DateTimeFormat<LocalDateTime> = getIsoDateTimeFormat()): LocalDateTime?
expect fun LocalTime.Companion.parseOrNull(input: CharSequence, format: DateTimeFormat<LocalTime> = getIsoTimeFormat()): LocalTime?
expect fun UtcOffset.Companion.parseOrNull(input: CharSequence, format: DateTimeFormat<UtcOffset> = getIsoUtcOffsetFormat()): UtcOffset?
expect fun YearMonth.Companion.parseOrNull(input: CharSequence, format: DateTimeFormat<YearMonth> = YearMonth.Formats.ISO): YearMonth?

A shortcut for calling DateTimeFormat.parseOrNull.

Link copied to clipboard

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

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

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

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

Link copied to clipboard
actual 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.

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

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.

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

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.

Returns a YearMonth that results from adding the value number of the specified unit to this year-month.

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

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.

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

Link copied to clipboard

The YearMonth one month later.

Link copied to clipboard

The YearMonth 12 months later.

Link copied to clipboard

Returns a LocalDate that has the given dayOfWeek earlier than this date.

Link copied to clipboard

Returns a LocalDate that has the given dayOfWeek not later than this date.

Link copied to clipboard

Returns a random LocalDate within the bounds of the LocalDateProgression.

Returns a random YearMonth within the bounds of the YearMonthProgression.

Link copied to clipboard

Returns a random LocalDate within the bounds of the LocalDateProgression or null if the progression is empty.

Returns a random YearMonth within the bounds of the YearMonthProgression or null if the progression is empty.

Link copied to clipboard

Returns a reversed LocalDateProgression, i.e. one that goes from last to first. The sign of the step is switched, in order to reverse the direction of the progression.

Returns a reversed YearMonthProgression, i.e. one that goes from last to first. The sign of the step is switched, in order to reverse the direction of the progression.

Link copied to clipboard

Returns a LocalDateProgression with the same start and end, but a changed step value.

Returns a YearMonthProgression with the same start and end, but a changed step value.

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

Creates a kotlinx.datetime.Clock delegating to the version of Clock from the standard library.

Link copied to clipboard

Creates a kotlinx.datetime.Instant identical to the version of Instant from the standard library.

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

Returns an instant that corresponds to this civil datetime value in the specified timeZone.

actual fun LocalDateTime.toInstant(offset: UtcOffset, youShallNotPass: OverloadMarker): Instant

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

expect fun LocalDateTime.toInstant(timeZone: TimeZone, youShallNotPass: OverloadMarker = OverloadMarker.INSTANCE): Instant

Returns an instant that corresponds to this civil datetime value in the specified timeZone.

expect fun LocalDateTime.toInstant(offset: UtcOffset, youShallNotPass: OverloadMarker = OverloadMarker.INSTANCE): Instant

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

actual fun LocalDateTime.toInstant(timeZone: TimeZone, youShallNotPass: OverloadMarker): Instant

Returns an instant that corresponds to this civil datetime value in the specified timeZone.

actual fun LocalDateTime.toInstant(offset: UtcOffset, youShallNotPass: OverloadMarker): Instant

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

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Converts this kotlinx.datetime.Month value to a java.time.Month value.

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
Link copied to clipboard
fun NSDate.toKotlinInstant(youShallNotPass: OverloadMarker = OverloadMarker.INSTANCE): 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

Converts this java.time.Month value to a kotlinx.datetime.Month value.

Link copied to clipboard
fun NSTimeZone.toKotlinTimeZone(): TimeZone

Converts the NSTimeZone to the corresponding TimeZone.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Returns a civil datetime value that this instant has in the specified timeZone.

Returns a civil datetime value that this instant has in the specified timeZone.

Returns a civil datetime value that this instant has in the specified timeZone.

Link copied to clipboard
Link copied to clipboard
fun Instant.toNSDate(): NSDate

Converts the Instant to an instance of NSDate.

Link copied to clipboard
fun LocalDate.toNSDateComponents(): NSDateComponents

Converts the given LocalDate to NSDateComponents.

fun LocalDateTime.toNSDateComponents(): NSDateComponents

Converts the given LocalDateTime to NSDateComponents.

fun YearMonth.toNSDateComponents(): NSDateComponents

Converts the given YearMonth to NSDateComponents.

Link copied to clipboard
fun TimeZone.toNSTimeZone(): NSTimeZone

Converts the TimeZone to NSTimeZone.

Link copied to clipboard

Creates a kotlin.time.Clock (the standard library version of Clock) delegating to this.

Link copied to clipboard

Creates a kotlin.time.Instant (the standard library version of Instant) identical to this.

Link copied to clipboard

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

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.

Returns the whole number of the specified month-based units between this and other year-months.

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.

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

Link copied to clipboard
actual fun UtcOffset(hours: Int? = null, minutes: Int? = null, seconds: Int? = null): UtcOffset

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

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

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

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

Returns the number of whole years between two dates.

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

Returns the number of whole years between two dates.

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

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

Returns the number of whole years between two dates.