core / io.islandtime / OffsetTime

OffsetTime

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) class OffsetTime

A time of day with an offset from UTC.

Constructors

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

<init>

Creates an OffsetTime.

<init>(hour: Int, minute: Int, second: Int = 0, nanosecond: Int = 0, offset: UtcOffset)

Creates an OffsetTime by combining a Time and UtcOffset.

<init>(time: Time, offset: UtcOffset)

Properties

(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)

minute

The minute of the hour.

val minute: Int
(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)

nanosecondsSinceStartOfUtcDay

The number of nanoseconds since the start of the day, but normalized to a UTC offset of zero, allowing OffsetTime objects with different offsets to be compared.

val nanosecondsSinceStartOfUtcDay: LongNanoseconds
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

offset

The offset from UTC.

val offset: UtcOffset
(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

Functions

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

adjustedTo

Changes the offset of this OffsetTime, adjusting the time component such that the instant represented by it remains the same.

fun adjustedTo(newOffset: UtcOffset): OffsetTime
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

compareTo

Compares to another OffsetTime based on timeline order, ignoring offset differences.

operator fun compareTo(other: OffsetTime): Int
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

copy

Returns a copy of this time with the values of any individual components replaced by the new values specified.

fun copy(time: Time = this.time, offset: UtcOffset = this.offset): OffsetTime
fun copy(hour: Int = this.hour, minute: Int = this.minute, second: Int = this.second, nanosecond: Int = this.nanosecond, offset: UtcOffset = this.offset): OffsetTime
(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)

minus

operator fun minus(duration: Duration): OffsetTime
operator fun minus(hours: LongHours): OffsetTime
operator fun minus(hours: IntHours): OffsetTime
operator fun minus(minutes: LongMinutes): OffsetTime
operator fun minus(minutes: IntMinutes): OffsetTime
operator fun minus(seconds: LongSeconds): OffsetTime
operator fun minus(seconds: IntSeconds): OffsetTime
operator fun minus(milliseconds: LongMilliseconds): OffsetTime
operator fun minus(milliseconds: IntMilliseconds): OffsetTime
operator fun minus(microseconds: LongMicroseconds): OffsetTime
operator fun minus(microseconds: IntMicroseconds): OffsetTime
operator fun minus(nanoseconds: LongNanoseconds): OffsetTime
operator fun minus(nanoseconds: IntNanoseconds): OffsetTime
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

plus

operator fun plus(duration: Duration): OffsetTime
operator fun plus(hours: LongHours): OffsetTime
operator fun plus(hours: IntHours): OffsetTime
operator fun plus(minutes: LongMinutes): OffsetTime
operator fun plus(minutes: IntMinutes): OffsetTime
operator fun plus(seconds: LongSeconds): OffsetTime
operator fun plus(seconds: IntSeconds): OffsetTime
operator fun plus(milliseconds: LongMilliseconds): OffsetTime
operator fun plus(milliseconds: IntMilliseconds): OffsetTime
operator fun plus(microseconds: LongMicroseconds): OffsetTime
operator fun plus(microseconds: IntMicroseconds): OffsetTime
operator fun plus(nanoseconds: LongNanoseconds): OffsetTime
operator fun plus(nanoseconds: IntNanoseconds): OffsetTime
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

toString

Converts this time to a string in ISO-8601 extended format. For example, 17:31:45.923452091-04:00 or 02:30Z.

fun toString(): String

Companion Object Properties

DEFAULT_SORT_ORDER

Compares by UTC equivalent instant, then time. Using this Comparator guarantees a deterministic order when sorting.

(iosArm64, iosX64, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) val DEFAULT_SORT_ORDER: <ERROR CLASS>
(jvm) val DEFAULT_SORT_ORDER: Comparator<OffsetTime>
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

MAX

The largest allowed OffsetTime -- 23:59:59.999999999-18:00.

val MAX: OffsetTime
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

MIN

The smallest allowed OffsetTime -- 00:00+18:00.

val MIN: OffsetTime

TIMELINE_ORDER

Compares by timeline order only, ignoring any offset differences.

(iosArm64, iosX64, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) val TIMELINE_ORDER: <ERROR CLASS>
(jvm) val TIMELINE_ORDER: Comparator<OffsetTime>

Extension Functions

(jvm)

toJavaOffsetTime

Convert to an equivalent Java OffsetTime.

fun OffsetTime.toJavaOffsetTime(): OffsetTime