Skip to content

//core/io.islandtime

Package-level declarations

common darwin jvm

Date-time primitives and core concepts, including classes such as Date, Time, Instant, and ZonedDateTime.

Types

Name Summary
Date

common


@Serializable(with = DateIsoSerializer::class)

class Date(val year: Int, val month: Month, day: Int) : Comparable<Date>


A date in an ambiguous region.
DateTime

common


@Serializable(with = DateTimeIsoSerializer::class)

class DateTime(val date: Date, val time: Time) : Comparable<DateTime>


A date and time of day in an ambiguous region.
DateTimeException

common


open class DateTimeException(message: String? = null, cause: Throwable? = null) : Exception
DayOfWeek

common


enum DayOfWeek : Enum<DayOfWeek>

A day of the week.
Instant

common


@Serializable(with = InstantIsoSerializer::class)

class Instant : TimePoint<Instant> , Comparable<Instant>


An instant in time with nanosecond-precision.
IslandTime

common


object IslandTime

Global configuration for Island Time.
Month

common


enum Month : Enum<Month>

A month of the year.
OffsetConversionStrategy

common


enum OffsetConversionStrategy : Enum<OffsetConversionStrategy>

Strategy to use when converting a local date-time accompanied by a UtcOffset to a date and time that are valid according to the rules of a TimeZone.
OffsetDateTime

common


@Serializable(with = OffsetDateTimeIsoSerializer::class)

class OffsetDateTime(val dateTime: DateTime, val offset: UtcOffset) : TimePoint<OffsetDateTime>


A date and time of day with an offset from UTC.
OffsetTime

common


@Serializable(with = OffsetTimeIsoSerializer::class)

class OffsetTime(val time: Time, val offset: UtcOffset)


A time of day with an offset from UTC.
PlatformInstant

common


expect class PlatformInstant

A platform-specific representation of an instant in time.

darwin jvm


darwin

actual typealias PlatformInstant = <Error class: unknown class>

jvm

actual typealias PlatformInstant = Instant
Time

common


@Serializable(with = TimeIsoSerializer::class)

class Time(val hour: Int, val minute: Int, val second: Int = 0, val nanosecond: Int = 0) : Comparable<Time>


A time of day in an ambiguous region.
TimeZone

common


@Serializable(with = TimeZoneSerializer::class)

sealed class TimeZone : Comparable<TimeZone>


A time zone.
UtcOffset

common


@Serializable(with = UtcOffsetIsoSerializer::class)

@JvmInline

value class UtcOffset : Comparable<UtcOffset>


The time shift between a local time and UTC.
Year

common


@Serializable(with = YearIsoSerializer::class)

@JvmInline

value class Year(val value: Int) : Comparable<Year>


A year as defined by ISO-8601.
YearMonth

common


@Serializable(with = YearMonthIsoSerializer::class)

class YearMonth(val year: Int, val month: Month) : Comparable<YearMonth>


A month in a particular year.
ZonedDateTime

common


@Serializable(with = ZonedDateTimeIsoSerializer::class)

class ZonedDateTime : TimePoint<ZonedDateTime>


A date and time of day in a particular region.

Properties

Name Summary
endOfDay

common


val Date.endOfDay: DateTime

The DateTime at the last representable instant of the day. Daylight savings transitions are not taken into account, so the returned date-time may not necessarily exist in all time zones.
endOfMonth

common


val Date.endOfMonth: Date

The date at the end of the month that this date falls in.

common


val DateTime.endOfMonth: DateTime

val OffsetDateTime.endOfMonth: OffsetDateTime

val ZonedDateTime.endOfMonth: ZonedDateTime

The date-time at the last representable instant of the month that this date-time falls in.
endOfWeek

common


val Date.endOfWeek: Date

The date at the end of the ISO week that this date falls in.

common


val DateTime.endOfWeek: DateTime

val OffsetDateTime.endOfWeek: OffsetDateTime

val ZonedDateTime.endOfWeek: ZonedDateTime

The date-time at the last representable instant of the ISO week that this date-time falls in.
endOfYear

common


val Date.endOfYear: Date

The date at the end of the year that this date falls in.

common


val DateTime.endOfYear: DateTime

val OffsetDateTime.endOfYear: OffsetDateTime

val ZonedDateTime.endOfYear: ZonedDateTime

The date-time at the last representable instant of the year that this date-time falls in.
isInLeapDay

common


val DateTime.isInLeapDay: Boolean

val OffsetDateTime.isInLeapDay: Boolean

val ZonedDateTime.isInLeapDay: Boolean

Checks if this date-time falls within February 29.
isInLeapYear

common


val Date.isInLeapYear: Boolean

Checks if this date falls within a leap year.

common


val DateTime.isInLeapYear: Boolean

val OffsetDateTime.isInLeapYear: Boolean

val ZonedDateTime.isInLeapYear: Boolean

Checks if this date-time falls within a leap year.
isLeapDay

common


val Date.isLeapDay: Boolean

Checks if this date is February 29.
lengthOfMonth

common


val Date.lengthOfMonth: Days

The length of this date's month in days.

common


val DateTime.lengthOfMonth: Days

val OffsetDateTime.lengthOfMonth: Days

val ZonedDateTime.lengthOfMonth: Days

The length of this date-time's month in days.
lengthOfWeekBasedYear

common


val Date.lengthOfWeekBasedYear: Weeks

The length of the ISO week-based year that this date falls in, either 52 or 53 weeks.

common


val DateTime.lengthOfWeekBasedYear: Weeks

val OffsetDateTime.lengthOfWeekBasedYear: Weeks

val ZonedDateTime.lengthOfWeekBasedYear: Weeks

The length of the ISO week-based year that this date-time falls in, either 52 or 53 weeks.
lengthOfYear

common


val Date.lengthOfYear: Days

The length of this date's year in days.

common


val DateTime.lengthOfYear: Days

val OffsetDateTime.lengthOfYear: Days

val ZonedDateTime.lengthOfYear: Days

The length of this date-time's year in days.
startOfDay

common


val Date.startOfDay: DateTime

The DateTime at the start of the day. Daylight savings transitions are not taken into account, so the returned date-time may not necessarily exist in all time zones.
startOfMonth

common


val Date.startOfMonth: Date

The date at the start of the month that this date falls in.

common


val DateTime.startOfMonth: DateTime

val OffsetDateTime.startOfMonth: OffsetDateTime

val ZonedDateTime.startOfMonth: ZonedDateTime

The date-time at the first instant of the month that this date-time falls in.
startOfWeek

common


val Date.startOfWeek: Date

The date at the start of the ISO week that this date falls in.

common


val DateTime.startOfWeek: DateTime

val OffsetDateTime.startOfWeek: OffsetDateTime

val ZonedDateTime.startOfWeek: ZonedDateTime

The date-time at the first instant of the ISO week that this date-time falls in.
startOfYear

common


val Date.startOfYear: Date

The date at the start of the year that this date falls in.

common


val DateTime.startOfYear: DateTime

val OffsetDateTime.startOfYear: OffsetDateTime

val ZonedDateTime.startOfYear: ZonedDateTime

The date-time at the first instant of the year that this date-time falls in.
week

common


val Date.week: DateRange

The range defining the ISO week that this date falls within.

common


val DateTime.week: DateTimeInterval

val OffsetDateTime.week: OffsetDateTimeInterval

val ZonedDateTime.week: ZonedDateTimeInterval

The interval defining the ISO week that this date-time falls within.
weekBasedYear

common


val Date.weekBasedYear: Int

val DateTime.weekBasedYear: Int

val OffsetDateTime.weekBasedYear: Int

val ZonedDateTime.weekBasedYear: Int

The week-based year used in the ISO week date system. This value differs from the regular ISO year when the week number falls in the preceding or following year.
weekOfMonth

common


val Date.weekOfMonth: Int

val DateTime.weekOfMonth: Int

val OffsetDateTime.weekOfMonth: Int

val ZonedDateTime.weekOfMonth: Int

The week of the month, from 0-6, calculated using the ISO week definition.
weekOfWeekBasedYear

common


val Date.weekOfWeekBasedYear: Int

val DateTime.weekOfWeekBasedYear: Int

val OffsetDateTime.weekOfWeekBasedYear: Int

val ZonedDateTime.weekOfWeekBasedYear: Int

The week number used in the ISO week date system.
weekOfYear

common


val Date.weekOfYear: Int

val DateTime.weekOfYear: Int

val OffsetDateTime.weekOfYear: Int

val ZonedDateTime.weekOfYear: Int

The week of the year, calculated using the ISO week definition. If the week number is associated with the preceding year, 0 will be returned.

Functions

Name Summary
asTimeZone

common


fun UtcOffset.asTimeZone(): TimeZone

Converts this UtcOffset into a fixed-offset TimeZone.
asUtcOffset

common


fun Hours.asUtcOffset(): UtcOffset

Converts a duration of hours into a UtcOffset of the same length.

common


fun Minutes.asUtcOffset(): UtcOffset

Converts a duration of minutes into a UtcOffset of the same length.

common


fun Seconds.asUtcOffset(): UtcOffset

Converts a duration of seconds into a UtcOffset of the same length.
asZonedDateTime

common


fun OffsetDateTime.asZonedDateTime(): ZonedDateTime

Converts this OffsetDateTime to an equivalent ZonedDateTime using a fixed-offset time zone.
at

common


infix fun Date.at(offsetTime: OffsetTime): OffsetDateTime

Combines a local date with a time and UTC offset to create an OffsetDateTime.

common


infix fun Date.at(time: Time): DateTime

Combines a Date with a Time to create a DateTime.

common


infix fun DateTime.at(zone: TimeZone): ZonedDateTime

Combines a local date and time with a time zone to create a ZonedDateTime.

common


infix fun DateTime.at(offset: UtcOffset): OffsetDateTime

Combines a local date and time with a UTC offset to create an OffsetDateTime.

common


infix fun Instant.at(zone: TimeZone): ZonedDateTime

Combines an instant with a time zone to create a ZonedDateTime.

common


infix fun Instant.at(offset: UtcOffset): OffsetDateTime

Combines an instant with a UTC offset to create an OffsetDateTime.

common


infix fun Time.at(offset: UtcOffset): OffsetTime

Combines a local time with a UTC offset to create an OffsetTime.

common


infix fun Year.at(month: Month): YearMonth

Combines a year and month to create a YearMonth.
atDay

common


fun YearMonth.atDay(day: Int): Date

Combines a YearMonth with a day of the month to create a Date.
atMonth

common


fun Year.atMonth(number: Int): YearMonth

Combines a year and month number to create a YearMonth.
atTime

common


fun Date.atTime(hour: Int, minute: Int, second: Int = 0, nanosecond: Int = 0): DateTime

Combines a Date with a time to create a DateTime.
between

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

common


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

Returns the number of whole microseconds between two time points.

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.

common


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

Returns the number of whole milliseconds 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 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: YearMonth, endExclusive: YearMonth): Months

Returns the number of months between two year-months.

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

common


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

Returns the number of nanoseconds 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.

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.

common


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

Returns the number of whole seconds between two time points.

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 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: 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: 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.
Date

common


fun Date(year: Int, dayOfYear: Int): Date

Creates a Date from a year and day of year
endOfDayAt

common


fun Date.endOfDayAt(zone: TimeZone): ZonedDateTime

The ZonedDateTime at the last representable instant of the day in zone, taking into account any daylight savings transitions.
endOfWeek

common


fun Date.endOfWeek(settings: WeekSettings): Date

The date at the end of the week that this date falls in. The first day of the week will be determined by settings. The first day of the week will be determined by the system settings. The first day of the week will be determined by the system settings. This may differ from the first day of the week associated with the default locale on platforms that allow this to be customized.

common


fun Date.endOfWeek(locale: Locale): Date

The date at the end of the week that this date falls in. The first day of the week will be determined by locale.

common


fun DateTime.endOfWeek(settings: WeekSettings): DateTime

The date-time at the last representable instant of the week that this date-time falls in. The first day of the week will be determined by the system settings. This may differ from the first day of the week associated with the default locale on platforms that allow this to be customized.

common


fun DateTime.endOfWeek(locale: Locale): DateTime

fun OffsetDateTime.endOfWeek(locale: Locale): OffsetDateTime

fun ZonedDateTime.endOfWeek(locale: Locale): ZonedDateTime

The date-time at the last representable instant of the week that this date-time falls in. The first day of the week will be determined by locale.

common


fun OffsetDateTime.endOfWeek(settings: WeekSettings): OffsetDateTime

fun ZonedDateTime.endOfWeek(settings: WeekSettings): ZonedDateTime

The date-time at the last representable instant of the week that this date-time falls in. The first day of the week will be determined by the user's system settings. This may differ from the first day of the week associated with the default locale on platforms that allow the user to customize this.
fromWeekDate

common


fun Date.Companion.fromWeekDate(year: Int, week: Int, day: Int): Date

Creates a Date from an ISO week date.

common


fun Date.Companion.fromWeekDate(year: Int, week: Int, day: Int, settings: WeekSettings): Date

Creates a Date from a week date representation using the week definition in settings.

common


fun Date.Companion.fromWeekDate(year: Int, week: Int, day: Int, locale: Locale): Date

Creates a Date from a week date representation using the week definition associated with the provided locale.
Instant

common


fun Instant(millisecondsSinceUnixEpoch: Milliseconds): Instant

Creates the Instant represented by a number of milliseconds relative to the Unix epoch of 1970-01-01T00:00Z.

common


fun Instant(secondsSinceUnixEpoch: Seconds): Instant

Creates the Instant represented by a number of seconds relative to the Unix epoch of 1970-01-01T00:00Z.

common


fun Instant(secondsSinceUnixEpoch: Seconds, nanosecondAdjustment: Nanoseconds): Instant

Creates the Instant represented by a number of seconds and additional nanoseconds relative to the Unix epoch of 1970-01-01T00:00Z.
next

common


fun Date.next(dayOfWeek: DayOfWeek): Date

The next date after this one that falls on dayOfWeek.

common


fun DateTime.next(dayOfWeek: DayOfWeek): DateTime

fun OffsetDateTime.next(dayOfWeek: DayOfWeek): OffsetDateTime

fun ZonedDateTime.next(dayOfWeek: DayOfWeek): ZonedDateTime

The next date-time after this one that falls on dayOfWeek.
nextOrSame

common


fun Date.nextOrSame(dayOfWeek: DayOfWeek): Date

The next date that falls on dayOfWeek, or this date if it falls on the same day.

common


fun DateTime.nextOrSame(dayOfWeek: DayOfWeek): DateTime

fun OffsetDateTime.nextOrSame(dayOfWeek: DayOfWeek): OffsetDateTime

fun ZonedDateTime.nextOrSame(dayOfWeek: DayOfWeek): ZonedDateTime

The next date-time that falls on dayOfWeek, or this date-time if it falls on the same day.
previous

common


fun Date.previous(dayOfWeek: DayOfWeek): Date

The last date before this one that falls on dayOfWeek.

common


fun DateTime.previous(dayOfWeek: DayOfWeek): DateTime

fun OffsetDateTime.previous(dayOfWeek: DayOfWeek): OffsetDateTime

fun ZonedDateTime.previous(dayOfWeek: DayOfWeek): ZonedDateTime

The last date-time before this one that falls on dayOfWeek.
previousOrSame

common


fun Date.previousOrSame(dayOfWeek: DayOfWeek): Date

The previous date that falls on dayOfWeek, or this date if it falls on the same day.

common


fun DateTime.previousOrSame(dayOfWeek: DayOfWeek): DateTime

fun OffsetDateTime.previousOrSame(dayOfWeek: DayOfWeek): OffsetDateTime

fun ZonedDateTime.previousOrSame(dayOfWeek: DayOfWeek): ZonedDateTime

The previous date-time that falls on dayOfWeek, or this date-time if it falls on the same day.
roundedDownTo

common


fun DateTime.roundedDownTo(unit: TimeUnit): DateTime

fun OffsetDateTime.roundedDownTo(unit: TimeUnit): OffsetDateTime

fun ZonedDateTime.roundedDownTo(unit: TimeUnit): ZonedDateTime

Returns this date-time, rounded down to match the precision of a given unit.

common


fun Instant.roundedDownTo(unit: TimeUnit): Instant

Returns this instant, rounded down to match the precision of a given unit.

common


fun OffsetTime.roundedDownTo(unit: TimeUnit): OffsetTime

fun Time.roundedDownTo(unit: TimeUnit): Time

Returns this time, rounded down to match the precision of a given unit.
roundedDownToNearest

common


fun DateTime.roundedDownToNearest(increment: Hours): DateTime

fun OffsetDateTime.roundedDownToNearest(increment: Hours): OffsetDateTime

fun ZonedDateTime.roundedDownToNearest(increment: Hours): ZonedDateTime

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

common


fun DateTime.roundedDownToNearest(increment: Microseconds): DateTime

fun OffsetDateTime.roundedDownToNearest(increment: Microseconds): OffsetDateTime

fun ZonedDateTime.roundedDownToNearest(increment: Microseconds): ZonedDateTime

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

common


fun DateTime.roundedDownToNearest(increment: Milliseconds): DateTime

fun OffsetDateTime.roundedDownToNearest(increment: Milliseconds): OffsetDateTime

fun ZonedDateTime.roundedDownToNearest(increment: Milliseconds): ZonedDateTime

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

common


fun DateTime.roundedDownToNearest(increment: Minutes): DateTime

fun OffsetDateTime.roundedDownToNearest(increment: Minutes): OffsetDateTime

fun ZonedDateTime.roundedDownToNearest(increment: Minutes): ZonedDateTime

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

common


fun DateTime.roundedDownToNearest(increment: Nanoseconds): DateTime

fun OffsetDateTime.roundedDownToNearest(increment: Nanoseconds): OffsetDateTime

fun ZonedDateTime.roundedDownToNearest(increment: Nanoseconds): ZonedDateTime

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

common


fun DateTime.roundedDownToNearest(increment: Seconds): DateTime

fun OffsetDateTime.roundedDownToNearest(increment: Seconds): OffsetDateTime

fun ZonedDateTime.roundedDownToNearest(increment: Seconds): ZonedDateTime

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

common


fun Instant.roundedDownToNearest(increment: Hours): Instant

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

common


fun Instant.roundedDownToNearest(increment: Microseconds): Instant

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

common


fun Instant.roundedDownToNearest(increment: Milliseconds): Instant

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

common


fun Instant.roundedDownToNearest(increment: Minutes): Instant

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

common


fun Instant.roundedDownToNearest(increment: Nanoseconds): Instant

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

common


fun Instant.roundedDownToNearest(increment: Seconds): Instant

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

common


fun OffsetTime.roundedDownToNearest(increment: Hours): OffsetTime

fun Time.roundedDownToNearest(increment: Hours): Time

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

common


fun OffsetTime.roundedDownToNearest(increment: Microseconds): OffsetTime

fun Time.roundedDownToNearest(increment: Microseconds): Time

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

common


fun OffsetTime.roundedDownToNearest(increment: Milliseconds): OffsetTime

fun Time.roundedDownToNearest(increment: Milliseconds): Time

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

common


fun OffsetTime.roundedDownToNearest(increment: Minutes): OffsetTime

fun Time.roundedDownToNearest(increment: Minutes): Time

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

common


fun OffsetTime.roundedDownToNearest(increment: Nanoseconds): OffsetTime

fun Time.roundedDownToNearest(increment: Nanoseconds): Time

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

common


fun OffsetTime.roundedDownToNearest(increment: Seconds): OffsetTime

fun Time.roundedDownToNearest(increment: Seconds): Time

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

common


fun DateTime.roundedTo(unit: TimeUnit): DateTime

fun OffsetDateTime.roundedTo(unit: TimeUnit): OffsetDateTime

fun ZonedDateTime.roundedTo(unit: TimeUnit): ZonedDateTime

Returns this date-time, rounded to match the precision of a given unit. If the time is halfway between whole values of the unit, it will be rounded up.

common


fun Instant.roundedTo(unit: TimeUnit): Instant

Returns this instant, rounded to match the precision of a given unit. If the time is halfway between whole values of the unit, it will be rounded up.

common


fun OffsetTime.roundedTo(unit: TimeUnit): OffsetTime

fun Time.roundedTo(unit: TimeUnit): Time

Returns this time, rounded to match the precision of a given unit. If the time is halfway between whole values of the unit, it will be rounded up.
roundedToNearest

common


fun DateTime.roundedToNearest(increment: Hours): DateTime

fun OffsetDateTime.roundedToNearest(increment: Hours): OffsetDateTime

fun ZonedDateTime.roundedToNearest(increment: Hours): ZonedDateTime

Returns this date-time, rounded to the nearest hour that satisfies the increment. If the time is halfway between increments, it will be rounded up.

common


fun DateTime.roundedToNearest(increment: Microseconds): DateTime

fun OffsetDateTime.roundedToNearest(increment: Microseconds): OffsetDateTime

fun ZonedDateTime.roundedToNearest(increment: Microseconds): ZonedDateTime

Returns this date-time, rounded to the nearest microsecond that satisfies the increment. If the time is halfway between increments, it will be rounded up.

common


fun DateTime.roundedToNearest(increment: Milliseconds): DateTime

fun OffsetDateTime.roundedToNearest(increment: Milliseconds): OffsetDateTime

fun ZonedDateTime.roundedToNearest(increment: Milliseconds): ZonedDateTime

Returns this date-time, rounded to the nearest millisecond that satisfies the increment. If the time is halfway between increments, it will be rounded up.

common


fun DateTime.roundedToNearest(increment: Minutes): DateTime

fun OffsetDateTime.roundedToNearest(increment: Minutes): OffsetDateTime

fun ZonedDateTime.roundedToNearest(increment: Minutes): ZonedDateTime

Returns this date-time, rounded to the nearest minute that satisfies the increment. If the time is halfway between increments, it will be rounded up.

common


fun DateTime.roundedToNearest(increment: Nanoseconds): DateTime

fun OffsetDateTime.roundedToNearest(increment: Nanoseconds): OffsetDateTime

fun ZonedDateTime.roundedToNearest(increment: Nanoseconds): ZonedDateTime

Returns this date-time, rounded to the nearest nanosecond that satisfies the increment. If the time is halfway between increments, it will be rounded up.

common


fun DateTime.roundedToNearest(increment: Seconds): DateTime

fun OffsetDateTime.roundedToNearest(increment: Seconds): OffsetDateTime

fun ZonedDateTime.roundedToNearest(increment: Seconds): ZonedDateTime

Returns this date-time, rounded to the nearest second that satisfies the increment. If the time is halfway between increments, it will be rounded up.

common


fun Instant.roundedToNearest(increment: Hours): Instant

Returns this instant, rounded to the nearest hour that satisfies the increment. If the time is halfway between increments, it will be rounded up.

common


fun Instant.roundedToNearest(increment: Microseconds): Instant

Returns this instant, rounded to the nearest microsecond that satisfies the increment. If the time is halfway between increments, it will be rounded up.

common


fun Instant.roundedToNearest(increment: Milliseconds): Instant

Returns this instant, rounded to the nearest millisecond that satisfies the increment. If the time is halfway between increments, it will be rounded up.

common


fun Instant.roundedToNearest(increment: Minutes): Instant

Returns this instant, rounded to the nearest minute that satisfies the increment. If the time is halfway between increments, it will be rounded up.

common


fun Instant.roundedToNearest(increment: Nanoseconds): Instant

Returns this instant, rounded to the nearest nanosecond that satisfies the increment. If the time is halfway between increments, it will be rounded up.

common


fun Instant.roundedToNearest(increment: Seconds): Instant

Returns this instant, rounded to the nearest second that satisfies the increment. If the time is halfway between increments, it will be rounded up.

common


fun OffsetTime.roundedToNearest(increment: Hours): OffsetTime

fun Time.roundedToNearest(increment: Hours): Time

Returns this time, rounded to the nearest hour that satisfies the increment. If the time is halfway between increments, it will be rounded up.

common


fun OffsetTime.roundedToNearest(increment: Microseconds): OffsetTime

fun Time.roundedToNearest(increment: Microseconds): Time

Returns this time, rounded to the nearest microsecond that satisfies the increment. If the time is halfway between increments, it will be rounded up.

common


fun OffsetTime.roundedToNearest(increment: Milliseconds): OffsetTime

fun Time.roundedToNearest(increment: Milliseconds): Time

Returns this time, rounded to the nearest millisecond that satisfies the increment. If the time is halfway between increments, it will be rounded up.

common


fun OffsetTime.roundedToNearest(increment: Minutes): OffsetTime

fun Time.roundedToNearest(increment: Minutes): Time

Returns this time, rounded to the nearest minute that satisfies the increment. If the time is halfway between increments, it will be rounded up.

common


fun OffsetTime.roundedToNearest(increment: Nanoseconds): OffsetTime

fun Time.roundedToNearest(increment: Nanoseconds): Time

Returns this time, rounded to the nearest nanosecond that satisfies the increment. If the time is halfway between increments, it will be rounded up.

common


fun OffsetTime.roundedToNearest(increment: Seconds): OffsetTime

fun Time.roundedToNearest(increment: Seconds): Time

Returns this time, rounded to the nearest second that satisfies the increment. If the time is halfway between increments, it will be rounded up.
roundedUpTo

common


fun DateTime.roundedUpTo(unit: TimeUnit): DateTime

fun OffsetDateTime.roundedUpTo(unit: TimeUnit): OffsetDateTime

fun ZonedDateTime.roundedUpTo(unit: TimeUnit): ZonedDateTime

Returns this date-time, rounded up to match the precision of a given unit.

common


fun Instant.roundedUpTo(unit: TimeUnit): Instant

Returns this instant, rounded up to match the precision of a given unit.

common


fun OffsetTime.roundedUpTo(unit: TimeUnit): OffsetTime

fun Time.roundedUpTo(unit: TimeUnit): Time

Returns this time, rounded up to match the precision of a given unit.
roundedUpToNearest

common


fun DateTime.roundedUpToNearest(increment: Hours): DateTime

fun OffsetDateTime.roundedUpToNearest(increment: Hours): OffsetDateTime

fun ZonedDateTime.roundedUpToNearest(increment: Hours): ZonedDateTime

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

common


fun DateTime.roundedUpToNearest(increment: Microseconds): DateTime

fun OffsetDateTime.roundedUpToNearest(increment: Microseconds): OffsetDateTime

fun ZonedDateTime.roundedUpToNearest(increment: Microseconds): ZonedDateTime

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

common


fun DateTime.roundedUpToNearest(increment: Milliseconds): DateTime

fun OffsetDateTime.roundedUpToNearest(increment: Milliseconds): OffsetDateTime

fun ZonedDateTime.roundedUpToNearest(increment: Milliseconds): ZonedDateTime

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

common


fun DateTime.roundedUpToNearest(increment: Minutes): DateTime

fun OffsetDateTime.roundedUpToNearest(increment: Minutes): OffsetDateTime

fun ZonedDateTime.roundedUpToNearest(increment: Minutes): ZonedDateTime

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

common


fun DateTime.roundedUpToNearest(increment: Nanoseconds): DateTime

fun OffsetDateTime.roundedUpToNearest(increment: Nanoseconds): OffsetDateTime

fun ZonedDateTime.roundedUpToNearest(increment: Nanoseconds): ZonedDateTime

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

common


fun DateTime.roundedUpToNearest(increment: Seconds): DateTime

fun OffsetDateTime.roundedUpToNearest(increment: Seconds): OffsetDateTime

fun ZonedDateTime.roundedUpToNearest(increment: Seconds): ZonedDateTime

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

common


fun Instant.roundedUpToNearest(increment: Hours): Instant

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

common


fun Instant.roundedUpToNearest(increment: Microseconds): Instant

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

common


fun Instant.roundedUpToNearest(increment: Milliseconds): Instant

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

common


fun Instant.roundedUpToNearest(increment: Minutes): Instant

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

common


fun Instant.roundedUpToNearest(increment: Nanoseconds): Instant

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

common


fun Instant.roundedUpToNearest(increment: Seconds): Instant

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

common


fun OffsetTime.roundedUpToNearest(increment: Hours): OffsetTime

fun Time.roundedUpToNearest(increment: Hours): Time

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

common


fun OffsetTime.roundedUpToNearest(increment: Microseconds): OffsetTime

fun Time.roundedUpToNearest(increment: Microseconds): Time

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

common


fun OffsetTime.roundedUpToNearest(increment: Milliseconds): OffsetTime

fun Time.roundedUpToNearest(increment: Milliseconds): Time

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

common


fun OffsetTime.roundedUpToNearest(increment: Minutes): OffsetTime

fun Time.roundedUpToNearest(increment: Minutes): Time

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

common


fun OffsetTime.roundedUpToNearest(increment: Nanoseconds): OffsetTime

fun Time.roundedUpToNearest(increment: Nanoseconds): Time

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

common


fun OffsetTime.roundedUpToNearest(increment: Seconds): OffsetTime

fun Time.roundedUpToNearest(increment: Seconds): Time

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

common


fun Date.startOfDayAt(zone: TimeZone): ZonedDateTime

The ZonedDateTime at the start of the day in zone, taking into account any daylight savings transitions.
startOfWeek

common


fun Date.startOfWeek(settings: WeekSettings): Date

The date at the start of the week that this date falls in. The first day of the week will be determined by settings.

common


fun Date.startOfWeek(locale: Locale): Date

The date at the start of the week that this date falls in. The first day of the week will be determined by locale.

common


fun DateTime.startOfWeek(settings: WeekSettings): DateTime

The date-time at the first instant of the week that this date-time falls in. The first day of the week will be determined by the system settings. This may differ from the first day of the week associated with the default locale on platforms that allow this to be customized.

common


fun DateTime.startOfWeek(locale: Locale): DateTime

fun OffsetDateTime.startOfWeek(locale: Locale): OffsetDateTime

fun ZonedDateTime.startOfWeek(locale: Locale): ZonedDateTime

The date-time at the first instant of the week that this date-time falls in. The first day of the week will be determined by locale.

common


fun OffsetDateTime.startOfWeek(settings: WeekSettings): OffsetDateTime

fun ZonedDateTime.startOfWeek(settings: WeekSettings): ZonedDateTime

The date-time at the first instant of the week that this date-time falls in. The first day of the week will be determined by the user's system settings. This may differ from the first day of the week associated with the default locale on platforms that allow the user to customize this.
TimeZone

common


fun TimeZone(id: String): TimeZone

Creates a TimeZone from an identifier.
toDate

common


fun String.toDate(): Date

Converts a string to a Date.

common


fun String.toDate(parser: DateTimeParser, settings: DateTimeParserSettings = DateTimeParserSettings.DEFAULT): Date

Converts a string to a Date using a specific parser.
toDateAt

common


fun Instant.toDateAt(zone: TimeZone): Date

Converts this instant to the corresponding Date in zone.

common


fun Instant.toDateAt(offset: UtcOffset): Date

Converts this instant to the corresponding Date at offset.
toDateTime

common


fun String.toDateTime(): DateTime

Convert a string to a DateTime.

common


fun String.toDateTime(parser: DateTimeParser, settings: DateTimeParserSettings = DateTimeParserSettings.DEFAULT): DateTime

Converts a string to a DateTime using a specific parser.
toDateTimeAt

common


fun Instant.toDateTimeAt(zone: TimeZone): DateTime

Converts this instant to the corresponding DateTime in zone.

common


fun Instant.toDateTimeAt(offset: UtcOffset): DateTime

Converts this instant to the corresponding DateTime at offset.
toDayOfWeek

common


fun Int.toDayOfWeek(): DayOfWeek

Converts an ISO day of week number to a DayOfWeek.

common


fun Int.toDayOfWeek(settings: WeekSettings): DayOfWeek

Converts a day of week number (1-7) to a DayOfWeek using the week definition provided by settings.
toInstant

common


fun OffsetDateTime.toInstant(): Instant

fun ZonedDateTime.toInstant(): Instant

Converts this date-time to an Instant representing the same time point.

common


fun String.toInstant(): Instant

Converts a string to an Instant.

common


fun String.toInstant(parser: DateTimeParser, settings: DateTimeParserSettings = DateTimeParserSettings.DEFAULT): Instant

Converts a string to an Instant using a specific parser.
toInstantAt

common


fun DateTime.toInstantAt(offset: UtcOffset): Instant

Converts this date-time to the corresponding Instant at offset.
toMonth

common


fun Int.toMonth(): Month

Converts an ISO month number, from 1-12, to a Month.
toOffsetDateTime

common


fun ZonedDateTime.toOffsetDateTime(): OffsetDateTime

Returns the combined date, time, and UTC offset.

common


fun String.toOffsetDateTime(): OffsetDateTime

Converts a string to an OffsetDateTime.

common


fun String.toOffsetDateTime(parser: DateTimeParser, settings: DateTimeParserSettings = DateTimeParserSettings.DEFAULT): OffsetDateTime

Converts a string to an OffsetDateTime using a specific parser.
toOffsetTime

common


fun OffsetDateTime.toOffsetTime(): OffsetTime

fun ZonedDateTime.toOffsetTime(): OffsetTime

Returns the combined time and UTC offset.

common


fun String.toOffsetTime(): OffsetTime

Converts a string to an OffsetTime.

common


fun String.toOffsetTime(parser: DateTimeParser, settings: DateTimeParserSettings = DateTimeParserSettings.DEFAULT): OffsetTime

Converts a string to an OffsetTime using a specific parser.
toTime

common


fun String.toTime(): Time

Converts a string to a Time.

common


fun String.toTime(parser: DateTimeParser, settings: DateTimeParserSettings = DateTimeParserSettings.DEFAULT): Time

Converts a string to a Time using a specific parser.
toUtcOffset

common


fun String.toUtcOffset(): UtcOffset

Converts a string to a UtcOffset.

common


fun String.toUtcOffset(parser: DateTimeParser, settings: DateTimeParserSettings = DateTimeParserSettings.DEFAULT): UtcOffset

Converts a string to a UtcOffset using a specific parser.
toWeekDate

common


inline fun <T> Date.toWeekDate(action: (year: Int, week: Int, day: Int) -> T): T

Converts this date to an ISO week date representation.

common


inline fun <T> Date.toWeekDate(settings: WeekSettings, action: (year: Int, week: Int, day: Int) -> T): T

Converts this date to a week date representation using the week definition in settings.

common


inline fun <T> Date.toWeekDate(locale: Locale, action: (year: Int, week: Int, day: Int) -> T): T

Converts this date to a week date representation using the week definition associated with the provided locale.
toYear

common


fun Date.toYear(): Year

Returns this date with the precision reduced to the year.

common


fun DateTime.toYear(): Year

fun OffsetDateTime.toYear(): Year

fun ZonedDateTime.toYear(): Year

Returns this date-time with the precision reduced to the year.

common


fun YearMonth.toYear(): Year

Returns this year-month with the precision reduced to the year.

common


fun String.toYear(): Year

Converts a string to a Year.

common


fun String.toYear(parser: DateTimeParser, settings: DateTimeParserSettings = DateTimeParserSettings.DEFAULT): Year

Converts a string to a Year using a specific parser.
toYearMonth

common


fun Date.toYearMonth(): YearMonth

Returns this date with the precision reduced to the month.

common


fun DateTime.toYearMonth(): YearMonth

fun OffsetDateTime.toYearMonth(): YearMonth

fun ZonedDateTime.toYearMonth(): YearMonth

Returns this date-time with the precision reduced to the month.

common


fun String.toYearMonth(): YearMonth

Converts a string to a YearMonth.

common


fun String.toYearMonth(parser: DateTimeParser, settings: DateTimeParserSettings = DateTimeParserSettings.DEFAULT): YearMonth

Converts a string to a YearMonth using a specific parser.
toZonedDateTime

common


fun String.toZonedDateTime(): ZonedDateTime

Converts a string to a ZonedDateTime.

common


fun OffsetDateTime.toZonedDateTime(zone: TimeZone, strategy: OffsetConversionStrategy): ZonedDateTime

Converts this OffsetDateTime to a ZonedDateTime using the specified strategy to adjust it to a valid date, time, and offset in zone.

common


fun String.toZonedDateTime(parser: DateTimeParser, settings: DateTimeParserSettings = DateTimeParserSettings.DEFAULT): ZonedDateTime

Converts a string to a ZonedDateTime using a specific parser.
truncatedTo

common


fun DateTime.truncatedTo(unit: TimeUnit): DateTime

fun OffsetDateTime.truncatedTo(unit: TimeUnit): OffsetDateTime

fun ZonedDateTime.truncatedTo(unit: TimeUnit): ZonedDateTime

Returns this date-time, rounded down to match the precision of a given unit.

common


fun Instant.truncatedTo(unit: TimeUnit): Instant

Returns this instant, rounded down to match the precision of a given unit.

common


fun OffsetTime.truncatedTo(unit: TimeUnit): OffsetTime

fun Time.truncatedTo(unit: TimeUnit): Time

Returns this time, rounded down to match the precision of a given unit.
UtcOffset

common


fun UtcOffset(hours: Hours, minutes: Minutes = 0.minutes, seconds: Seconds = 0.seconds): UtcOffset

Creates a UTC offset of hours, minutes, and seconds. Each component must be within its valid range and without any mixed positive and negative values.
week

common


fun Date.week(settings: WeekSettings): DateRange

The range defining the week that this date falls within. The first day of the week will be determined by the provided settings.

common


fun Date.week(locale: Locale): DateRange

The range defining the week that this date falls within. The first day of the week will be the default associated with the provided locale.

common


fun DateTime.week(settings: WeekSettings): DateTimeInterval

fun OffsetDateTime.week(settings: WeekSettings): OffsetDateTimeInterval

fun ZonedDateTime.week(settings: WeekSettings): ZonedDateTimeInterval

The interval defining the week that this date-time falls within. The first day of the week will be determined by the provided settings.

common


fun DateTime.week(locale: Locale): DateTimeInterval

fun OffsetDateTime.week(locale: Locale): OffsetDateTimeInterval

fun ZonedDateTime.week(locale: Locale): ZonedDateTimeInterval

The interval defining the week that this date-time falls within. The first day of the week will be the default associated with the provided locale.
weekBasedYear

common


fun Date.weekBasedYear(settings: WeekSettings): Int

fun DateTime.weekBasedYear(settings: WeekSettings): Int

fun OffsetDateTime.weekBasedYear(settings: WeekSettings): Int

fun ZonedDateTime.weekBasedYear(settings: WeekSettings): Int

The week-based year, calculated using the week definition in settings. This value differs from the regular ISO year when the week number falls in the preceding or following year.

common


fun Date.weekBasedYear(locale: Locale): Int

fun DateTime.weekBasedYear(locale: Locale): Int

fun OffsetDateTime.weekBasedYear(locale: Locale): Int

fun ZonedDateTime.weekBasedYear(locale: Locale): Int

The week-based year, calculated using the week definition associated with the provided locale. This value differs from the regular ISO year when the week number falls in the preceding or following year.
weekOfMonth

common


fun Date.weekOfMonth(settings: WeekSettings): Int

fun DateTime.weekOfMonth(settings: WeekSettings): Int

fun OffsetDateTime.weekOfMonth(settings: WeekSettings): Int

fun ZonedDateTime.weekOfMonth(settings: WeekSettings): Int

The week of the month, from 0-6, calculated using the week definition in settings.

common


fun Date.weekOfMonth(locale: Locale): Int

fun DateTime.weekOfMonth(locale: Locale): Int

fun OffsetDateTime.weekOfMonth(locale: Locale): Int

fun ZonedDateTime.weekOfMonth(locale: Locale): Int

The week of the month, from 0-6, calculated using the default week definition associated with the provided locale.
weekOfWeekBasedYear

common


fun Date.weekOfWeekBasedYear(settings: WeekSettings): Int

fun DateTime.weekOfWeekBasedYear(settings: WeekSettings): Int

fun OffsetDateTime.weekOfWeekBasedYear(settings: WeekSettings): Int

fun ZonedDateTime.weekOfWeekBasedYear(settings: WeekSettings): Int

The week number of the week-based year, calculated using the week definition in settings.

common


fun Date.weekOfWeekBasedYear(locale: Locale): Int

fun DateTime.weekOfWeekBasedYear(locale: Locale): Int

fun OffsetDateTime.weekOfWeekBasedYear(locale: Locale): Int

fun ZonedDateTime.weekOfWeekBasedYear(locale: Locale): Int

The week number of the week-based year, calculated using the week definition associated with the provided locale.
weekOfYear

common


fun Date.weekOfYear(settings: WeekSettings): Int

fun DateTime.weekOfYear(settings: WeekSettings): Int

fun OffsetDateTime.weekOfYear(settings: WeekSettings): Int

fun ZonedDateTime.weekOfYear(settings: WeekSettings): Int

The week of the year, calculated using the week definition in settings. If the week number is associated with the preceding year, 0 will be returned.

common


fun Date.weekOfYear(locale: Locale): Int

fun DateTime.weekOfYear(locale: Locale): Int

fun OffsetDateTime.weekOfYear(locale: Locale): Int

fun ZonedDateTime.weekOfYear(locale: Locale): Int

The week of the year, calculated using the week definition associated with the provided locale. If the week number is associated with the preceding year, 0 will be returned.
ZonedDateTime

common


fun ZonedDateTime(dateTime: DateTime, zone: TimeZone): ZonedDateTime

fun ZonedDateTime(date: Date, time: Time, zone: TimeZone): ZonedDateTime

fun ZonedDateTime(year: Int, dayOfYear: Int, hour: Int, minute: Int, second: Int, nanosecond: Int, zone: TimeZone): ZonedDateTime

fun ZonedDateTime(year: Int, month: Month, day: Int, hour: Int, minute: Int, second: Int, nanosecond: Int, zone: TimeZone): ZonedDateTime

fun ZonedDateTime(year: Int, monthNumber: Int, day: Int, hour: Int, minute: Int, second: Int, nanosecond: Int, zone: TimeZone): ZonedDateTime

Creates a ZonedDateTime from a local date and time.