Companion

object Companion

Functions

equals
Link copied to clipboard
common
open operator override fun equals(other: Any?): Boolean
fromInstant
Link copied to clipboard
common

Creates a ZonedDateTime from the instant represented by a local date-time and offset. The resulting ZonedDateTime may have a different date-time and offset depending on the time zone rules, but the instant will be the same.

fun fromInstant(dateTime: DateTime, offset: UtcOffset, zone: TimeZone): ZonedDateTime
fromLocal
Link copied to clipboard
common

Creates a ZonedDateTime from a local date and time, optionally using a preferred offset. If the local date and time fall during an overlap, preferredOffset will be used if it represents one of the two valid offsets. If it is null or invalid, it will be ignored.

fun fromLocal(dateTime: DateTime, zone: TimeZone, preferredOffset: UtcOffset?): ZonedDateTime
fromMillisecondOfUnixEpoch
Link copied to clipboard
common

Creates a ZonedDateTime from the millisecond of the Unix epoch at zone.

fun fromMillisecondOfUnixEpoch(millisecond: Long, zone: TimeZone): ZonedDateTime
fromMillisecondsSinceUnixEpoch
Link copied to clipboard
common

Creates a ZonedDateTime from a duration of milliseconds relative to the Unix epoch at zone.

fun fromMillisecondsSinceUnixEpoch(milliseconds: LongMilliseconds, zone: TimeZone): ZonedDateTime
fromSecondOfUnixEpoch
Link copied to clipboard
common

Creates a ZonedDateTime from the second of the Unix epoch at zone.

fun fromSecondOfUnixEpoch(second: Long, nanosecond: Int, zone: TimeZone): ZonedDateTime
fromSecondsSinceUnixEpoch
Link copied to clipboard
common

Creates a ZonedDateTime from a duration of seconds relative to the Unix epoch at zone, optionally, with some number of additional nanoseconds added to it.

fun fromSecondsSinceUnixEpoch(seconds: LongSeconds, nanosecondAdjustment: IntNanoseconds, zone: TimeZone): ZonedDateTime
hashCode
Link copied to clipboard
common
open override fun hashCode(): Int
toString
Link copied to clipboard
common
open override fun toString(): String

Properties

DEFAULT_SORT_ORDER
Link copied to clipboard
common

A Comparator that compares by instant, then date-time, then time zone. Using this Comparator guarantees a deterministic order when sorting.

val DEFAULT_SORT_ORDER: Comparator<ZonedDateTime>
TIMELINE_ORDER
Link copied to clipboard
common

A Comparator that compares by timeline order only, ignoring any offset or time zone differences.

val TIMELINE_ORDER: Comparator<TimePoint<*>>

Extensions

now
Link copied to clipboard

Gets the current ZonedDateTime from the provided clock.

fun ZonedDateTime.Companion.now(clock: Clock): ZonedDateTime

Gets the current ZonedDateTime from the system clock.

common
fun ZonedDateTime.Companion.now(): ZonedDateTime

Gets the current ZonedDateTime from the provided clock.

common
fun ZonedDateTime.Companion.now(clock: Clock): ZonedDateTime