OffsetTime

A time of day with an offset from UTC.

class OffsetTime(time: Time,offset: UtcOffset)

Constructors

OffsetTime
Link copied to clipboard
common

Creates an OffsetTime.

fun OffsetTime(hour: Int, minute: Int, second: Int, nanosecond: Int, offset: UtcOffset)
OffsetTime
Link copied to clipboard
common

Creates an OffsetTime by combining a Time and UtcOffset.

fun OffsetTime(time: Time, offset: UtcOffset)

Types

Companion
Link copied to clipboard
common
object Companion

Functions

adjustedTo
Link copied to clipboard
common

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
compareTo
Link copied to clipboard
common

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

operator fun compareTo(other: OffsetTime): Int
copy
Link copied to clipboard
common

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

fun copy(time: Time, offset: UtcOffset): OffsetTime
fun copy(hour: Int, minute: Int, second: Int, nanosecond: Int, offset: UtcOffset): OffsetTime
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
minus
Link copied to clipboard
common
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
plus
Link copied to clipboard
common
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
toString
Link copied to clipboard
common

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

open override fun toString(): String

Properties

hour
Link copied to clipboard
common

The hour of the day.

val hour: Int
minute
Link copied to clipboard
common

The minute of the hour.

val minute: Int
nanosecond
Link copied to clipboard
common

The nanosecond of the second.

val nanosecond: Int
nanosecondsSinceStartOfUtcDay
Link copied to clipboard
common

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
offset
Link copied to clipboard
common

The offset from UTC.

val offset: UtcOffset
second
Link copied to clipboard
common

The second of the minute.

val second: Int
time
Link copied to clipboard
common

The time of day.

val time: Time

Extensions

roundedDownTo
Link copied to clipboard
common

Returns this time, rounded down to match the precision of a given unit.

This is equivalent to truncatedTo.

fun OffsetTime.roundedDownTo(unit: TimeUnit): OffsetTime
roundedDownToNearest
Link copied to clipboard
common

Returns this time, rounded down to the nearest hour that satisfies the increment.

The increment must multiply evenly into a 24-hour day.

fun OffsetTime.roundedDownToNearest(increment: IntHours): OffsetTime

Returns this time, rounded down to the nearest minute that satisfies the increment.

The increment must multiply evenly into an hour.

fun OffsetTime.roundedDownToNearest(increment: IntMinutes): OffsetTime

Returns this time, rounded down to the nearest second that satisfies the increment.

The increment must multiply evenly into a minute.

fun OffsetTime.roundedDownToNearest(increment: IntSeconds): OffsetTime

Returns this time, rounded down to the nearest millisecond that satisfies the increment.

The increment must multiply evenly into a second.

fun OffsetTime.roundedDownToNearest(increment: IntMilliseconds): OffsetTime

Returns this time, rounded down to the nearest microsecond that satisfies the increment.

The increment must multiply evenly into a second.

fun OffsetTime.roundedDownToNearest(increment: IntMicroseconds): OffsetTime

Returns this time, rounded down to the nearest nanosecond that satisfies the increment.

The increment must multiply evenly into a second.

fun OffsetTime.roundedDownToNearest(increment: IntNanoseconds): OffsetTime
roundedTo
Link copied to clipboard
common

Returns this 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.

fun OffsetTime.roundedTo(unit: TimeUnit): OffsetTime
roundedToNearest
Link copied to clipboard
common

Returns this time, rounded to the nearest hour that satisfies the increment. If the time is halfway between increments, it will be rounded up.

The increment must multiply evenly into a 24-hour day.

fun OffsetTime.roundedToNearest(increment: IntHours): OffsetTime

Returns this time, rounded to the nearest minute that satisfies the increment. If the time is halfway between increments, it will be rounded up.

The increment must multiply evenly into an hour.

fun OffsetTime.roundedToNearest(increment: IntMinutes): OffsetTime

Returns this time, rounded to the nearest second that satisfies the increment. If the time is halfway between increments, it will be rounded up.

The increment must multiply evenly into a minute.

fun OffsetTime.roundedToNearest(increment: IntSeconds): OffsetTime

Returns this time, rounded to the nearest millisecond that satisfies the increment. If the time is halfway between increments, it will be rounded up.

The increment must multiply evenly into a second.

fun OffsetTime.roundedToNearest(increment: IntMilliseconds): OffsetTime

Returns this time, rounded to the nearest microsecond that satisfies the increment. If the time is halfway between increments, it will be rounded up.

The increment must multiply evenly into a second.

fun OffsetTime.roundedToNearest(increment: IntMicroseconds): OffsetTime

Returns this time, rounded to the nearest nanosecond that satisfies the increment. If the time is halfway between increments, it will be rounded up.

The increment must multiply evenly into a second.

fun OffsetTime.roundedToNearest(increment: IntNanoseconds): OffsetTime
roundedUpTo
Link copied to clipboard
common

Returns this time, rounded up to match the precision of a given unit.

fun OffsetTime.roundedUpTo(unit: TimeUnit): OffsetTime
roundedUpToNearest
Link copied to clipboard
common

Returns this time, rounded up to the nearest hour that satisfies the increment.

The increment must multiply evenly into a 24-hour day.

fun OffsetTime.roundedUpToNearest(increment: IntHours): OffsetTime

Returns this time, rounded up to the nearest minute that satisfies the increment.

The increment must multiply evenly into an hour.

fun OffsetTime.roundedUpToNearest(increment: IntMinutes): OffsetTime

Returns this time, rounded up to the nearest second that satisfies the increment.

The increment must multiply evenly into a minute.

fun OffsetTime.roundedUpToNearest(increment: IntSeconds): OffsetTime

Returns this time, rounded up to the nearest millisecond that satisfies the increment.

The increment must multiply evenly into a second.

fun OffsetTime.roundedUpToNearest(increment: IntMilliseconds): OffsetTime

Returns this time, rounded up to the nearest microsecond that satisfies the increment.

The increment must multiply evenly into a second.

fun OffsetTime.roundedUpToNearest(increment: IntMicroseconds): OffsetTime

Returns this time, rounded up to the nearest nanosecond that satisfies the increment.

The increment must multiply evenly into a second.

fun OffsetTime.roundedUpToNearest(increment: IntNanoseconds): OffsetTime
toJavaOffsetTime
Link copied to clipboard

Converts this time to an equivalent Java OffsetTime.

fun OffsetTime.toJavaOffsetTime(): OffsetTime
toNSDateComponents
Link copied to clipboard
darwin

Converts this time to an equivalent NSDateComponents object.

fun OffsetTime.toNSDateComponents(includeCalendar: Boolean): <ERROR CLASS>
truncatedTo
Link copied to clipboard
common

Returns this time, rounded down to match the precision of a given unit.

This is equivalent to roundedDownTo.

fun OffsetTime.truncatedTo(unit: TimeUnit): OffsetTime