//core/io.islandtime/ZonedDateTime
ZonedDateTime¶
common
class ZonedDateTime : TimePoint<ZonedDateTime>
A date and time of day in a particular region.
ZonedDateTime
takes time zone rules into account when performing calendrical calculations.
Types¶
Name | Summary |
---|---|
Companion | common object Companion |
Functions¶
Name | Summary |
---|---|
adjustedTo | common fun adjustedTo(newTimeZone: TimeZone): ZonedDateTime Changes the time zone of a ZonedDateTime, adjusting the date, time, and offset such that the instant represented by it remains the same. |
compareTo | common open operator fun compareTo(other: TimePoint<*>): Int Compares this time point with another time point. |
copy | common fun copy(dateTime: DateTime = this.dateTime, offset: UtcOffset = this.offset, zone: TimeZone = this.zone): ZonedDateTime fun copy(date: Date = this.date, time: Time = this.time, offset: UtcOffset = this.offset, zone: TimeZone = this.zone): ZonedDateTime fun 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, offset: UtcOffset = this.offset, zone: TimeZone = this.zone): ZonedDateTime fun 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, offset: UtcOffset = this.offset, zone: TimeZone = this.zone): ZonedDateTime fun 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, offset: UtcOffset = this.offset, zone: TimeZone = this.zone): ZonedDateTime Returns a copy of this date-time with the values of any individual components replaced by the new values specified. |
equals | common open operator override fun equals(other: Any?): Boolean |
hashCode | common open override fun hashCode(): Int |
isSameInstantAs | common open fun isSameInstantAs(other: TimePoint<*>): Boolean Checks if this time point represents the same instant as other. Unlike the equals operator, equality is determined solely by timeline order. |
minus | common operator fun minus(centuries: Centuries): ZonedDateTime Returns this date-time with centuries subtracted from it. common operator fun minus(days: Days): ZonedDateTime Returns this date-time with days subtracted from it. common operator fun minus(decades: Decades): ZonedDateTime Returns this date-time with decades subtracted from it. common operator fun minus(duration: Duration): ZonedDateTime common open operator override fun minus(hours: Hours): ZonedDateTime Returns this date-time with hours subtracted from it. common open operator override fun minus(microseconds: Microseconds): ZonedDateTime Returns this date-time with microseconds subtracted from it. common open operator override fun minus(milliseconds: Milliseconds): ZonedDateTime Returns this date-time with milliseconds subtracted from it. common open operator override fun minus(minutes: Minutes): ZonedDateTime Returns this date-time with minutes subtracted from it. common operator fun minus(months: Months): ZonedDateTime Returns this date-time with months subtracted from it. common open operator override fun minus(nanoseconds: Nanoseconds): ZonedDateTime Returns this date-time with nanoseconds subtracted from it. common operator fun minus(period: Period): ZonedDateTime Returns this date-time with period subtracted from it. common open operator override fun minus(seconds: Seconds): ZonedDateTime Returns this date-time with seconds subtracted from it. common operator fun minus(weeks: Weeks): ZonedDateTime Returns this date-time with weeks subtracted from it. common operator fun minus(years: Years): ZonedDateTime Returns this date-time with years subtracted from it. common operator fun minus(duration: Duration): ZonedDateTime Returns this date-time with duration subtracted from it. |
plus | common operator fun plus(centuries: Centuries): ZonedDateTime Returns this date-tme with centuries added to it. common operator fun plus(days: Days): ZonedDateTime Returns this date-time with days added to it. common operator fun plus(decades: Decades): ZonedDateTime Returns this date-time with decades added to it. common operator fun plus(duration: Duration): ZonedDateTime common open operator override fun plus(hours: Hours): ZonedDateTime Returns this date-time with hours added to it. common open operator override fun plus(microseconds: Microseconds): ZonedDateTime Returns this date-time with microseconds added to it. common open operator override fun plus(milliseconds: Milliseconds): ZonedDateTime Returns this date-time with milliseconds added to it. common open operator override fun plus(minutes: Minutes): ZonedDateTime Returns this date-time with minutes added to it. common operator fun plus(months: Months): ZonedDateTime Returns this date-time with months added to it. common open operator override fun plus(nanoseconds: Nanoseconds): ZonedDateTime Returns this date-time with nanoseconds added to it. common operator fun plus(period: Period): ZonedDateTime Returns this date-time with period added to it. common open operator override fun plus(seconds: Seconds): ZonedDateTime Returns this date-time with seconds added to it. common operator fun plus(weeks: Weeks): ZonedDateTime Returns this date-time with weeks added to it. common operator fun plus(years: Years): ZonedDateTime Returns this date-time with years added to it. common operator fun plus(duration: Duration): ZonedDateTime Returns this date-time with duration added to it. |
rangeTo | common operator fun rangeTo(other: ZonedDateTime): ZonedDateTimeInterval |
toString | common open override fun toString(): String Converts this date-time to a string in ISO-8601 extended format. For example, 2012-04-15T17:31:45.923452091-04:00[America/New_York] or 2020-02-13T02:30Z . |
withEarlierOffsetAtOverlap | common fun withEarlierOffsetAtOverlap(): ZonedDateTime If the local date-time falls during an overlap caused by a daylight savings transition, a ZonedDateTime with the same local date and time will be returned, but using the earlier of the two valid offsets. |
withFixedOffsetZone | common fun withFixedOffsetZone(): ZonedDateTime If this date-time uses a region-based time zone, a copy with a fixed offset will be returned. Otherwise, this date-time will be returned unchanged. |
withLaterOffsetAtOverlap | common fun withLaterOffsetAtOverlap(): ZonedDateTime If the local date-time falls during an overlap caused by a daylight savings transition, a ZonedDateTime with the same local date and time will be returned, but using the later of the two valid offsets. |
Properties¶
Name | Summary |
---|---|
additionalNanosecondsSinceUnixEpoch | common open val additionalNanosecondsSinceUnixEpoch: Nanoseconds The number of additional nanoseconds on top of secondsSinceUnixEpoch. |
date | common val date: Date The local date. |
dateTime | common val dateTime: DateTime The local date and time of day. |
dayOfMonth | common val dayOfMonth: Int The day of the month. |
dayOfWeek | common val dayOfWeek: DayOfWeek The day of the week. |
dayOfYear | common val dayOfYear: Int The day of the year. |
hour | common val hour: Int The hour of the day. |
millisecondOfUnixEpoch | common open override val millisecondOfUnixEpoch: Long The millisecond of the Unix epoch. |
millisecondsSinceUnixEpoch | common open val millisecondsSinceUnixEpoch: Milliseconds The number of milliseconds since the Unix epoch of 1970-01-01T00:00Z. |
minute | common val minute: Int The minute of the hour. |
month | common val month: Month The month of the year. |
monthNumber | common val monthNumber: Int The ISO month number, from 1-12. |
nanosecond | common open override val nanosecond: Int The nanosecond of the second. |
offset | common val offset: UtcOffset The offset from UTC. |
second | common val second: Int The second of the minute. |
secondOfUnixEpoch | common open override val secondOfUnixEpoch: Long The second of the Unix epoch. |
secondsSinceUnixEpoch | common open val secondsSinceUnixEpoch: Seconds The number of seconds since the Unix epoch of 1970-01-01T00:00Z. |
time | common val time: Time The local time of day. |
year | common val year: Int The year. |
zone | common val zone: TimeZone The time zone. |
Extensions¶
Name | Summary |
---|---|
endOfMonth | common val ZonedDateTime.endOfMonth: ZonedDateTime The date-time at the last representable instant of the month that this date-time falls in. |
endOfWeek | common val ZonedDateTime.endOfWeek: ZonedDateTime The date-time at the last representable instant of the ISO week that this date-time falls in. common 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. common 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. |
endOfYear | common val ZonedDateTime.endOfYear: ZonedDateTime The date-time at the last representable instant of the year that this date-time falls in. |
isInLeapDay | common val ZonedDateTime.isInLeapDay: Boolean Checks if this date-time falls within February 29. |
isInLeapYear | common val ZonedDateTime.isInLeapYear: Boolean Checks if this date-time falls within a leap year. |
lengthOfMonth | common val ZonedDateTime.lengthOfMonth: Days The length of this date-time's month in days. |
lengthOfWeekBasedYear | common 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 ZonedDateTime.lengthOfYear: Days The length of this date-time's year in days. |
next | common fun ZonedDateTime.next(dayOfWeek: DayOfWeek): ZonedDateTime The next date-time after this one that falls on dayOfWeek. |
nextOrSame | common 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 ZonedDateTime.previous(dayOfWeek: DayOfWeek): ZonedDateTime The last date-time before this one that falls on dayOfWeek. |
previousOrSame | common 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 ZonedDateTime.roundedDownTo(unit: TimeUnit): ZonedDateTime Returns this date-time, rounded down to match the precision of a given unit. |
roundedDownToNearest | common fun ZonedDateTime.roundedDownToNearest(increment: Hours): ZonedDateTime Returns this date-time, rounded down to the nearest hour that satisfies the increment. common fun ZonedDateTime.roundedDownToNearest(increment: Minutes): ZonedDateTime Returns this date-time, rounded down to the nearest minute that satisfies the increment. common fun ZonedDateTime.roundedDownToNearest(increment: Seconds): ZonedDateTime Returns this date-time, rounded down to the nearest second that satisfies the increment. common fun ZonedDateTime.roundedDownToNearest(increment: Milliseconds): ZonedDateTime Returns this date-time, rounded down to the nearest millisecond that satisfies the increment. common fun ZonedDateTime.roundedDownToNearest(increment: Microseconds): ZonedDateTime Returns this date-time, rounded down to the nearest microsecond that satisfies the increment. common fun ZonedDateTime.roundedDownToNearest(increment: Nanoseconds): ZonedDateTime Returns this date-time, rounded down to the nearest nanosecond that satisfies the increment. |
roundedTo | common 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. |
roundedToNearest | common 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 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 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 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 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 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. |
roundedUpTo | common fun ZonedDateTime.roundedUpTo(unit: TimeUnit): ZonedDateTime Returns this date-time, rounded up to match the precision of a given unit. |
roundedUpToNearest | common fun ZonedDateTime.roundedUpToNearest(increment: Hours): ZonedDateTime Returns this date-time, rounded up to the nearest hour that satisfies the increment. common fun ZonedDateTime.roundedUpToNearest(increment: Minutes): ZonedDateTime Returns this date-time, rounded up to the nearest minute that satisfies the increment. common fun ZonedDateTime.roundedUpToNearest(increment: Seconds): ZonedDateTime Returns this date-time, rounded up to the nearest second that satisfies the increment. common fun ZonedDateTime.roundedUpToNearest(increment: Milliseconds): ZonedDateTime Returns this date-time, rounded up to the nearest millisecond that satisfies the increment. common fun ZonedDateTime.roundedUpToNearest(increment: Microseconds): ZonedDateTime Returns this date-time, rounded up to the nearest microsecond that satisfies the increment. common fun ZonedDateTime.roundedUpToNearest(increment: Nanoseconds): ZonedDateTime Returns this date-time, rounded up to the nearest nanosecond that satisfies the increment. |
startOfMonth | common val ZonedDateTime.startOfMonth: ZonedDateTime The date-time at the first instant of the month that this date-time falls in. |
startOfWeek | common val ZonedDateTime.startOfWeek: ZonedDateTime The date-time at the first instant of the ISO week that this date-time falls in. common 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. common 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. |
startOfYear | common val ZonedDateTime.startOfYear: ZonedDateTime The date-time at the first instant of the year that this date-time falls in. |
toInstant | common fun ZonedDateTime.toInstant(): Instant Converts this date-time to an Instant representing the same time point. |
toJavaZonedDateTime | jvm fun ZonedDateTime.toJavaZonedDateTime(): ZonedDateTime Converts this date-time to an equivalent Java ZonedDateTime . |
toNSDateComponents | darwin fun ZonedDateTime.toNSDateComponents(includeCalendar: Boolean = false): <ERROR CLASS> Converts this date-time to an equivalent NSDateComponents object. |
toOffsetDateTime | common fun ZonedDateTime.toOffsetDateTime(): OffsetDateTime Returns the combined date, time, and UTC offset. |
toOffsetTime | common fun ZonedDateTime.toOffsetTime(): OffsetTime Returns the combined time and UTC offset. |
toYear | common fun ZonedDateTime.toYear(): Year Returns this date-time with the precision reduced to the year. |
toYearMonth | common fun ZonedDateTime.toYearMonth(): YearMonth Returns this date-time with the precision reduced to the month. |
truncatedTo | common fun ZonedDateTime.truncatedTo(unit: TimeUnit): ZonedDateTime Returns this date-time, rounded down to match the precision of a given unit. |
until | common infix fun ZonedDateTime.until(to: ZonedDateTime): ZonedDateTimeInterval Creates a ZonedDateTimeInterval from this date-time up to, but not including to. |
week | common val ZonedDateTime.week: ZonedDateTimeInterval The interval defining the ISO week that this date-time falls within. common 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 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 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. common 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 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 val ZonedDateTime.weekOfMonth: Int The week of the month, from 0-6, calculated using the ISO week definition. common fun ZonedDateTime.weekOfMonth(settings: WeekSettings): Int The week of the month, from 0-6, calculated using the week definition in settings. common 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 val ZonedDateTime.weekOfWeekBasedYear: Int The week number used in the ISO week date system. common fun ZonedDateTime.weekOfWeekBasedYear(settings: WeekSettings): Int The week number of the week-based year, calculated using the week definition in settings. common 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 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.common 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 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. |