class DateTime : Comparable<DateTime>
A date and time of day in an ambiguous region.
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
<init> |
Creates a DateTime. <init>(year: Int, month: Month, day: Int, hour: Int, minute: Int, second: Int = 0, nanosecond: Int = 0)<init>(year: Int, monthNumber: Int, day: Int, hour: Int, minute: Int, second: Int = 0, nanosecond: Int = 0)<init>(year: Int, dayOfYear: Int, hour: Int, minute: Int, second: Int, nanosecond: Int)
Creates a DateTime by combining a Date and Time. <init>(date: Date, time: Time) |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
additionalNanosecondsSinceUnixEpoch |
The number of additional nanoseconds that should be applied on top of the number of seconds since the Unix epoch returned by secondsSinceUnixEpochAt. val additionalNanosecondsSinceUnixEpoch: IntNanoseconds |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
date |
The date. val date: Date |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
dayOfMonth |
The day of the month. val dayOfMonth: Int |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
dayOfWeek |
The day of the week. val dayOfWeek: DayOfWeek |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
dayOfYear |
The day of the year. val dayOfYear: Int |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
hour |
The hour of the day. val hour: Int |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
isInLeapYear |
Check if this date falls within a leap year. val isInLeapYear: Boolean |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
isLeapDay |
Check if this is a leap day. val isLeapDay: Boolean |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
lengthOfMonth |
The length of the date's month in days. val lengthOfMonth: IntDays |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
lengthOfYear |
The length of the date's year in days. val lengthOfYear: IntDays |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
minute |
The minute of the hour. val minute: Int |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
month |
The month of the year. val month: Month |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
monthNumber |
The ISO month number, from 1-12. val monthNumber: Int |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
nanoOfSecondsSinceUnixEpoch |
val |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
nanosecond |
The nanosecond of the second. val nanosecond: Int |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
second |
The second of the minute. val second: Int |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
time |
The time of day. val time: Time |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
unixEpochNanoOfSecond |
val |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
year |
The year. val year: Int |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
yearMonth |
val |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
compareTo |
fun compareTo(other: DateTime): Int |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
component1 |
operator fun component1(): Date |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
component2 |
operator fun component2(): Time |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
copy |
Returns a copy of this date-time with the values of any individual components replaced by the new values specified. fun copy(date: Date = this.date, time: Time = this.time): DateTimefun copy(year: Int = this.year, dayOfYear: Int = this.dayOfYear, hour: Int = this.hour, minute: Int = this.minute, second: Int = this.second, nanosecond: Int = this.nanosecond): DateTimefun copy(year: Int = this.year, month: Month = this.month, dayOfMonth: Int = this.dayOfMonth, hour: Int = this.hour, minute: Int = this.minute, second: Int = this.second, nanosecond: Int = this.nanosecond): DateTimefun copy(year: Int = this.year, monthNumber: Int, dayOfMonth: Int = this.dayOfMonth, hour: Int = this.hour, minute: Int = this.minute, second: Int = this.second, nanosecond: Int = this.nanosecond): DateTime |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
equals |
fun equals(other: Any?): Boolean |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
hashCode |
fun hashCode(): Int |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
instantAt |
fun |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
millisecondOfUnixEpochAt |
The millisecond of the Unix epoch. fun millisecondOfUnixEpochAt(offset: UtcOffset): Long |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
millisecondsSinceUnixEpochAt |
The number of milliseconds relative to the Unix epoch of fun millisecondsSinceUnixEpochAt(offset: UtcOffset): LongMilliseconds |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
minus |
Returns this date-time with period subtracted from it. operator fun minus(period: Period): DateTimeoperator fun minus(duration: Duration): DateTimeoperator fun minus(years: IntYears): DateTimeoperator fun minus(years: LongYears): DateTimeoperator fun minus(months: IntMonths): DateTimeoperator fun minus(months: LongMonths): DateTimeoperator fun minus(weeks: IntWeeks): DateTimeoperator fun minus(weeks: LongWeeks): DateTimeoperator fun minus(days: IntDays): DateTimeoperator fun minus(days: LongDays): DateTimeoperator fun minus(hours: IntHours): DateTimeoperator fun minus(hours: LongHours): DateTimeoperator fun minus(minutes: IntMinutes): DateTimeoperator fun minus(minutes: LongMinutes): DateTimeoperator fun minus(seconds: IntSeconds): DateTimeoperator fun minus(seconds: LongSeconds): DateTimeoperator fun minus(milliseconds: IntMilliseconds): DateTimeoperator fun minus(milliseconds: LongMilliseconds): DateTimeoperator fun minus(microseconds: IntMicroseconds): DateTimeoperator fun minus(microseconds: LongMicroseconds): DateTimeoperator fun minus(nanoseconds: IntNanoseconds): DateTimeoperator fun minus(nanoseconds: LongNanoseconds): DateTime |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
plus |
Returns this date-time with period added to it. operator fun plus(period: Period): DateTimeoperator fun plus(duration: Duration): DateTimeoperator fun plus(years: IntYears): DateTimeoperator fun plus(years: LongYears): DateTimeoperator fun plus(months: IntMonths): DateTimeoperator fun plus(months: LongMonths): DateTimeoperator fun plus(weeks: IntWeeks): DateTimeoperator fun plus(weeks: LongWeeks): DateTimeoperator fun plus(days: IntDays): DateTimeoperator fun plus(days: LongDays): DateTimeoperator fun plus(hours: IntHours): DateTimeoperator fun plus(hours: LongHours): DateTimeoperator fun plus(minutes: IntMinutes): DateTimeoperator fun plus(minutes: LongMinutes): DateTimeoperator fun plus(seconds: IntSeconds): DateTimeoperator fun plus(seconds: LongSeconds): DateTimeoperator fun plus(milliseconds: IntMilliseconds): DateTimeoperator fun plus(milliseconds: LongMilliseconds): DateTimeoperator fun plus(microseconds: IntMicroseconds): DateTimeoperator fun plus(microseconds: LongMicroseconds): DateTimeoperator fun plus(nanoseconds: IntNanoseconds): DateTimeoperator fun plus(nanoseconds: LongNanoseconds): DateTime |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
rangeTo |
operator fun rangeTo(other: DateTime): DateTimeInterval |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
secondOfUnixEpochAt |
The second of the Unix epoch. fun secondOfUnixEpochAt(offset: UtcOffset): Long |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
secondsSinceUnixEpochAt |
The number of seconds relative to the Unix epoch of fun secondsSinceUnixEpochAt(offset: UtcOffset): LongSeconds |
toString |
Converts this date-time to a string in ISO-8601 extended format. For example, fun toString(): <ERROR CLASS>(jvm) fun toString(): String |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
unixEpochMillisecondAt |
fun |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
unixEpochSecondAt |
fun |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
MAX |
The latest supported DateTime, which can be used as a "far future" sentinel. val MAX: DateTime |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
MIN |
The earliest supported DateTime, which can be used as a "far past" sentinel. val MIN: DateTime |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
fromMillisecondOfUnixEpoch |
Creates a DateTime from the millisecond of the Unix epoch at offset. fun fromMillisecondOfUnixEpoch(millisecond: Long, offset: UtcOffset): DateTime |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
fromMillisecondsSinceUnixEpoch |
Creates a DateTime from a duration of milliseconds relative to the Unix epoch at offset. fun fromMillisecondsSinceUnixEpoch(millisecondsSinceUnixEpoch: LongMilliseconds, offset: UtcOffset): DateTime |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
fromSecondOfUnixEpoch |
Creates a DateTime from the second of the Unix epoch at offset and optionally, the nanosecond of the second. fun fromSecondOfUnixEpoch(second: Long, nanosecond: Int = 0, offset: UtcOffset): DateTime |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
fromSecondsSinceUnixEpoch |
Creates a DateTime from a duration of seconds relative to the Unix epoch at offset, optionally, with some number of additional nanoseconds added to it. fun fromSecondsSinceUnixEpoch(secondsSinceUnixEpoch: LongSeconds, nanosecondAdjustment: IntNanoseconds = 0.nanoseconds, offset: UtcOffset): DateTime |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
fromUnixEpochMillisecond |
fun |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
fromUnixEpochSecond |
fun |
(jvm)
endOfWeek |
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. fun DateTime.endOfWeek(locale: Locale): DateTime |
(jvm)
startOfWeek |
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. fun DateTime.startOfWeek(locale: Locale): DateTime |
(jvm)
toJavaLocalDateTime |
Convert to an equivalent Java fun DateTime.toJavaLocalDateTime(): LocalDateTime |
(jvm)
week |
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. fun DateTime.week(locale: Locale): DateTimeInterval |
(jvm)
weekBasedYear |
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. fun DateTime.weekBasedYear(locale: Locale): Int |
(jvm)
weekInterval |
fun DateTime. |
(jvm)
weekOfMonth |
The week of the month, from 0-6, calculated using the default week definition associated with the provided locale. fun DateTime.weekOfMonth(locale: Locale): Int |
(jvm)
weekOfWeekBasedYear |
The week number of the week-based year, calculated using the week definition associated with the provided locale. fun DateTime.weekOfWeekBasedYear(locale: Locale): Int |
(jvm)
weekOfYear |
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, fun DateTime.weekOfYear(locale: Locale): Int |