ZonedDateTime

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

Companion
Link copied to clipboard
common
object Companion

Functions

adjustedTo
Link copied to clipboard
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
Link copied to clipboard
common
open operator fun compareTo(other: TimePoint<*>): Int
Compares this time point with another time point.
copy
Link copied to clipboard
common
fun copy(dateTime: DateTime = this.dateTime, 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.
fun copy(date: Date = this.date, time: Time = this.time, 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.
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
Returns a copy of this date-time with the values of any individual components replaced by the new values specified.
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
Returns a copy of this date-time with the values of any individual components replaced by the new values specified.
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
Link copied to clipboard
common
open operator override fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
common
open override fun hashCode(): Int
isSameInstantAs
Link copied to clipboard
common
open fun isSameInstantAs(other: TimePoint<*>): Boolean
Checks if this time point represents the same instant as other.
minus
Link copied to clipboard
common
operator fun minus(duration: Duration): ZonedDateTime
operator fun minus(days: IntDays): ZonedDateTime
open operator override fun minus(hours: IntHours): ZonedDateTime
open operator override fun minus(microseconds: IntMicroseconds): ZonedDateTime
open operator override fun minus(milliseconds: IntMilliseconds): ZonedDateTime
open operator override fun minus(minutes: IntMinutes): ZonedDateTime
operator fun minus(months: IntMonths): ZonedDateTime
open operator override fun minus(nanoseconds: IntNanoseconds): ZonedDateTime
open operator override fun minus(seconds: IntSeconds): ZonedDateTime
operator fun minus(weeks: IntWeeks): ZonedDateTime
operator fun minus(years: IntYears): ZonedDateTime
operator fun minus(days: LongDays): ZonedDateTime
open operator override fun minus(hours: LongHours): ZonedDateTime
open operator override fun minus(microseconds: LongMicroseconds): ZonedDateTime
open operator override fun minus(milliseconds: LongMilliseconds): ZonedDateTime
open operator override fun minus(minutes: LongMinutes): ZonedDateTime
operator fun minus(months: LongMonths): ZonedDateTime
open operator override fun minus(nanoseconds: LongNanoseconds): ZonedDateTime
open operator override fun minus(seconds: LongSeconds): ZonedDateTime
operator fun minus(weeks: LongWeeks): ZonedDateTime
operator fun minus(years: LongYears): ZonedDateTime
operator fun minus(period: Period): ZonedDateTime
Returns this date-time with period subtracted from it.
plus
Link copied to clipboard
common
operator fun plus(duration: Duration): ZonedDateTime
operator fun plus(days: IntDays): ZonedDateTime
open operator override fun plus(hours: IntHours): ZonedDateTime
open operator override fun plus(microseconds: IntMicroseconds): ZonedDateTime
open operator override fun plus(milliseconds: IntMilliseconds): ZonedDateTime
open operator override fun plus(minutes: IntMinutes): ZonedDateTime
operator fun plus(months: IntMonths): ZonedDateTime
open operator override fun plus(nanoseconds: IntNanoseconds): ZonedDateTime
open operator override fun plus(seconds: IntSeconds): ZonedDateTime
operator fun plus(weeks: IntWeeks): ZonedDateTime
operator fun plus(years: IntYears): ZonedDateTime
operator fun plus(days: LongDays): ZonedDateTime
open operator override fun plus(hours: LongHours): ZonedDateTime
open operator override fun plus(microseconds: LongMicroseconds): ZonedDateTime
open operator override fun plus(milliseconds: LongMilliseconds): ZonedDateTime
open operator override fun plus(minutes: LongMinutes): ZonedDateTime
operator fun plus(months: LongMonths): ZonedDateTime
open operator override fun plus(nanoseconds: LongNanoseconds): ZonedDateTime
open operator override fun plus(seconds: LongSeconds): ZonedDateTime
operator fun plus(weeks: LongWeeks): ZonedDateTime
operator fun plus(years: LongYears): ZonedDateTime
operator fun plus(period: Period): ZonedDateTime
Returns this date-time with period added to it.
rangeTo
Link copied to clipboard
common
operator fun rangeTo(other: ZonedDateTime): ZonedDateTimeInterval
toString
Link copied to clipboard
common
open override fun toString(): String
Converts this date-time to a string in ISO-8601 extended format.
withEarlierOffsetAtOverlap
Link copied to clipboard
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
Link copied to clipboard
common
fun withFixedOffsetZone(): ZonedDateTime
If this date-time uses a region-based time zone, a copy with a fixed offset will be returned.
withLaterOffsetAtOverlap
Link copied to clipboard
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

additionalNanosecondsSinceUnixEpoch
Link copied to clipboard
common
open override val additionalNanosecondsSinceUnixEpoch: IntNanoseconds
The number of additional nanoseconds on top of secondsSinceUnixEpoch.
date
Link copied to clipboard
common
val date: Date
The local date.
dateTime
Link copied to clipboard
common
val dateTime: DateTime
The local date and time of day.
dayOfMonth
Link copied to clipboard
common
val dayOfMonth: Int
The day of the month.
dayOfWeek
Link copied to clipboard
common
val dayOfWeek: DayOfWeek
The day of the week.
dayOfYear
Link copied to clipboard
common
val dayOfYear: Int
The day of the year.
hour
Link copied to clipboard
common
val hour: Int
The hour of the day.
millisecondOfUnixEpoch
Link copied to clipboard
common
open val millisecondOfUnixEpoch: Long
The millisecond of the Unix epoch.
millisecondsSinceUnixEpoch
Link copied to clipboard
common
open override val millisecondsSinceUnixEpoch: LongMilliseconds
The number of milliseconds since the Unix epoch of 1970-01-01T00:00Z.
minute
Link copied to clipboard
common
val minute: Int
The minute of the hour.
month
Link copied to clipboard
common
val month: Month
The month of the year.
monthNumber
Link copied to clipboard
common
val monthNumber: Int
The ISO month number, from 1-12.
nanosecond
Link copied to clipboard
common
open override val nanosecond: Int
The nanosecond of the second.
offset
Link copied to clipboard
common
val offset: UtcOffset
The offset from UTC.
second
Link copied to clipboard
common
val second: Int
The second of the minute.
secondOfUnixEpoch
Link copied to clipboard
common
open val secondOfUnixEpoch: Long
The second of the Unix epoch.
secondsSinceUnixEpoch
Link copied to clipboard
common
open override val secondsSinceUnixEpoch: LongSeconds
The number of seconds since the Unix epoch of 1970-01-01T00:00Z.
time
Link copied to clipboard
common
val time: Time
The local time of day.
year
Link copied to clipboard
common
val year: Int
The year.
zone
Link copied to clipboard
common
val zone: TimeZone
The time zone.

Extensions

endOfMonth
Link copied to clipboard
common
val ZonedDateTime.endOfMonth: ZonedDateTime
The date-time at the last representable instant of the month that this date-time falls in.
endOfWeek
Link copied to clipboard
common
val ZonedDateTime.endOfWeek: ZonedDateTime
The date-time at the last representable instant of the ISO week that this date-time falls in.
fun ZonedDateTime.endOfWeek(settings: WeekSettings): ZonedDateTime
The date-time at the last representable instant of the week that this date-time falls in.
fun ZonedDateTime.endOfWeek(locale: Locale): ZonedDateTime
The date-time at the last representable instant of the week that this date-time falls in.
endOfYear
Link copied to clipboard
common
val ZonedDateTime.endOfYear: ZonedDateTime
The date-time at the last representable instant of the year that this date-time falls in.
isInLeapDay
Link copied to clipboard
common
val ZonedDateTime.isInLeapDay: Boolean
Checks if this date-time falls within February 29.
isInLeapYear
Link copied to clipboard
common
val ZonedDateTime.isInLeapYear: Boolean
Checks if this date-time falls within a leap year.
lengthOfMonth
Link copied to clipboard
common
val ZonedDateTime.lengthOfMonth: IntDays
The length of this date-time's month in days.
lengthOfWeekBasedYear
Link copied to clipboard
common
val ZonedDateTime.lengthOfWeekBasedYear: IntWeeks
The length of the ISO week-based year that this date-time falls in, either 52 or 53 weeks.
lengthOfYear
Link copied to clipboard
common
val ZonedDateTime.lengthOfYear: IntDays
The length of this date-time's year in days.
next
Link copied to clipboard
common
fun ZonedDateTime.next(dayOfWeek: DayOfWeek): ZonedDateTime
The next date-time after this one that falls on dayOfWeek.
nextOrSame
Link copied to clipboard
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
Link copied to clipboard
common
fun ZonedDateTime.previous(dayOfWeek: DayOfWeek): ZonedDateTime
The last date-time before this one that falls on dayOfWeek.
previousOrSame
Link copied to clipboard
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
Link copied to clipboard
common
fun ZonedDateTime.roundedDownTo(unit: TimeUnit): ZonedDateTime
Returns this date-time, rounded down to match the precision of a given unit.
roundedDownToNearest
Link copied to clipboard
common
fun ZonedDateTime.roundedDownToNearest(increment: IntHours): ZonedDateTime
Returns this date-time, rounded down to the nearest hour that satisfies the increment.
fun ZonedDateTime.roundedDownToNearest(increment: IntMinutes): ZonedDateTime
Returns this date-time, rounded down to the nearest minute that satisfies the increment.
fun ZonedDateTime.roundedDownToNearest(increment: IntSeconds): ZonedDateTime
Returns this date-time, rounded down to the nearest second that satisfies the increment.
fun ZonedDateTime.roundedDownToNearest(increment: IntMilliseconds): ZonedDateTime
Returns this date-time, rounded down to the nearest millisecond that satisfies the increment.
fun ZonedDateTime.roundedDownToNearest(increment: IntMicroseconds): ZonedDateTime
Returns this date-time, rounded down to the nearest microsecond that satisfies the increment.
fun ZonedDateTime.roundedDownToNearest(increment: IntNanoseconds): ZonedDateTime
Returns this date-time, rounded down to the nearest nanosecond that satisfies the increment.
roundedTo
Link copied to clipboard
common
fun ZonedDateTime.roundedTo(unit: TimeUnit): ZonedDateTime
Returns this date-time, rounded to match the precision of a given unit.
roundedToNearest
Link copied to clipboard
common
fun ZonedDateTime.roundedToNearest(increment: IntHours): ZonedDateTime
Returns this date-time, rounded to the nearest hour that satisfies the increment.
fun ZonedDateTime.roundedToNearest(increment: IntMinutes): ZonedDateTime
Returns this date-time, rounded to the nearest minute that satisfies the increment.
fun ZonedDateTime.roundedToNearest(increment: IntSeconds): ZonedDateTime
Returns this date-time, rounded to the nearest second that satisfies the increment.
fun ZonedDateTime.roundedToNearest(increment: IntMilliseconds): ZonedDateTime
Returns this date-time, rounded to the nearest millisecond that satisfies the increment.
fun ZonedDateTime.roundedToNearest(increment: IntMicroseconds): ZonedDateTime
Returns this date-time, rounded to the nearest microsecond that satisfies the increment.
fun ZonedDateTime.roundedToNearest(increment: IntNanoseconds): ZonedDateTime
Returns this date-time, rounded to the nearest nanosecond that satisfies the increment.
roundedUpTo
Link copied to clipboard
common
fun ZonedDateTime.roundedUpTo(unit: TimeUnit): ZonedDateTime
Returns this date-time, rounded up to match the precision of a given unit.
roundedUpToNearest
Link copied to clipboard
common
fun ZonedDateTime.roundedUpToNearest(increment: IntHours): ZonedDateTime
Returns this date-time, rounded up to the nearest hour that satisfies the increment.
fun ZonedDateTime.roundedUpToNearest(increment: IntMinutes): ZonedDateTime
Returns this date-time, rounded up to the nearest minute that satisfies the increment.
fun ZonedDateTime.roundedUpToNearest(increment: IntSeconds): ZonedDateTime
Returns this date-time, rounded up to the nearest second that satisfies the increment.
fun ZonedDateTime.roundedUpToNearest(increment: IntMilliseconds): ZonedDateTime
Returns this date-time, rounded up to the nearest millisecond that satisfies the increment.
fun ZonedDateTime.roundedUpToNearest(increment: IntMicroseconds): ZonedDateTime
Returns this date-time, rounded up to the nearest microsecond that satisfies the increment.
fun ZonedDateTime.roundedUpToNearest(increment: IntNanoseconds): ZonedDateTime
Returns this date-time, rounded up to the nearest nanosecond that satisfies the increment.
startOfMonth
Link copied to clipboard
common
val ZonedDateTime.startOfMonth: ZonedDateTime
The date-time at the first instant of the month that this date-time falls in.
startOfWeek
Link copied to clipboard
common
val ZonedDateTime.startOfWeek: ZonedDateTime
The date-time at the first instant of the ISO week that this date-time falls in.
fun ZonedDateTime.startOfWeek(settings: WeekSettings): ZonedDateTime
The date-time at the first instant of the week that this date-time falls in.
fun ZonedDateTime.startOfWeek(locale: Locale): ZonedDateTime
The date-time at the first instant of the week that this date-time falls in.
startOfYear
Link copied to clipboard
common
val ZonedDateTime.startOfYear: ZonedDateTime
The date-time at the first instant of the year that this date-time falls in.
toInstant
Link copied to clipboard
common
fun ZonedDateTime.toInstant(): Instant
Converts this date-time to an Instant representing the same time point.
toJavaZonedDateTime
Link copied to clipboard
fun ZonedDateTime.toJavaZonedDateTime(): ZonedDateTime
Converts this date-time to an equivalent Java ZonedDateTime.
toNSDateComponents
Link copied to clipboard
darwin
fun ZonedDateTime.toNSDateComponents(includeCalendar: Boolean = false): <ERROR CLASS>
Converts this date-time to an equivalent NSDateComponents object.
toOffsetDateTime
Link copied to clipboard
common
fun ZonedDateTime.toOffsetDateTime(): OffsetDateTime
Returns the combined date, time, and UTC offset.
toOffsetTime
Link copied to clipboard
common
fun ZonedDateTime.toOffsetTime(): OffsetTime
Returns the combined time and UTC offset.
toYear
Link copied to clipboard
common
fun ZonedDateTime.toYear(): Year
Returns this date-time with the precision reduced to the year.
toYearMonth
Link copied to clipboard
common
fun ZonedDateTime.toYearMonth(): YearMonth
Returns this date-time with the precision reduced to the month.
truncatedTo
Link copied to clipboard
common
fun ZonedDateTime.truncatedTo(unit: TimeUnit): ZonedDateTime
Returns this date-time, rounded down to match the precision of a given unit.
until
Link copied to clipboard
common
infix fun ZonedDateTime.until(to: ZonedDateTime): ZonedDateTimeInterval
Creates a ZonedDateTimeInterval from this date-time up to, but not including to.
week
Link copied to clipboard
common
val ZonedDateTime.week: ZonedDateTimeInterval
The interval defining the ISO week that this date-time falls within.
fun ZonedDateTime.week(settings: WeekSettings): ZonedDateTimeInterval
The interval defining the week that this date-time falls within.
fun ZonedDateTime.week(locale: Locale): ZonedDateTimeInterval
The interval defining the week that this date-time falls within.
weekBasedYear
Link copied to clipboard
common
val ZonedDateTime.weekBasedYear: Int
The week-based year used in the ISO week date system.
fun ZonedDateTime.weekBasedYear(settings: WeekSettings): Int
The week-based year, calculated using the week definition in settings.
fun ZonedDateTime.weekBasedYear(locale: Locale): Int
The week-based year, calculated using the week definition associated with the provided locale.
weekOfMonth
Link copied to clipboard
common
val ZonedDateTime.weekOfMonth: Int
The week of the month, from 0-6, calculated using the ISO week definition.
fun ZonedDateTime.weekOfMonth(settings: WeekSettings): Int
The week of the month, from 0-6, calculated using the week definition in settings.
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
Link copied to clipboard
common
val ZonedDateTime.weekOfWeekBasedYear: Int
The week number used in the ISO week date system.
fun ZonedDateTime.weekOfWeekBasedYear(settings: WeekSettings): Int
The week number of the week-based year, calculated using the week definition in settings.
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
Link copied to clipboard
common
val ZonedDateTime.weekOfYear: Int
The week of the year, calculated using the ISO week definition.
fun ZonedDateTime.weekOfYear(settings: WeekSettings): Int
The week of the year, calculated using the week definition in settings.
fun ZonedDateTime.weekOfYear(locale: Locale): Int
The week of the year, calculated using the week definition associated with the provided locale.