class OffsetDateTime
source · line 13public
public class OffsetDateTime public constructor(
/**
* The local date and time component.
*/
public val dateTime: LocalDateTime,
/**
* The fixed offset used to interpret the local component.
*/
public val offset: UtcOffset) : Equals<OffsetDateTime>, Hash, ToString
- Supertype
Equals<OffsetDateTime> - Supertype
Hash - Supertype
ToString
A local date-time paired with a fixed UTC offset. Equality compares both components, so equal instants can have unequal offset date-times.
function equals
source · line 38public
public override operator fun equals(other: OffsetDateTime): Boolean
- Overrides
equals
Compares the stored value components for equality.
parameter other
source · line 38public
other: OffsetDateTime
function hash
source · line 42public
public override fun hash(): Long
- Overrides
hash
Computes a hash consistent with component equality.
property offset
source · line 21public
public val offset: UtcOffset
get: public read-only
The fixed offset used to interpret the local component.
property dateTime
source · line 17public
public val dateTime: LocalDateTime
get: public read-only
The local date and time component.
constructor constructor
source · line 13public
constructor(public val dateTime: LocalDateTime, public val offset: UtcOffset)
parameter offset
source · line 21public
public val offset: UtcOffset
parameter dateTime
source · line 17public
public val dateTime: LocalDateTime
function withOffsetSameInstant
source · line 30public
public fun withOffsetSameInstant(offset: UtcOffset): OffsetDateTime
Changes the offset and adjusts local fields to preserve the absolute instant.
parameter offset
source · line 30public
offset: UtcOffset
function toInstant
source · line 26public
public fun toInstant(): Instant
Converts the local component and offset into an absolute instant.
function withOffsetSameLocal
source · line 34public
public fun withOffsetSameLocal(offset: UtcOffset): OffsetDateTime
Changes the offset while retaining local fields, changing the represented instant.
parameter offset
source · line 34public
offset: UtcOffset
function toString
source · line 46public
public override fun toString(): String
- Overrides
toString
Formats this value as ISO local date-time followed by a UTC offset.