OffsetTime

class OffsetTime(time: Time, offset: UtcOffset)

A time of day with an offset from UTC.

Throws

if the offset is invalid

Constructors

OffsetTime
Link copied to clipboard
common
fun OffsetTime(hour: Int, minute: Int, second: Int = 0, nanosecond: Int = 0, offset: UtcOffset)
Creates an OffsetTime.
OffsetTime
Link copied to clipboard
common
fun OffsetTime(time: Time, offset: UtcOffset)
Creates an OffsetTime by combining a Time and UtcOffset.

Types

Companion
Link copied to clipboard
common
object Companion

Functions

adjustedTo
Link copied to clipboard
common
fun adjustedTo(newOffset: UtcOffset): OffsetTime
Changes the offset of this OffsetTime, adjusting the time component such that the instant represented by it remains the same.
compareTo
Link copied to clipboard
common
operator fun compareTo(other: OffsetTime): Int
Compares to another OffsetTime based on timeline order, ignoring offset differences.
copy
Link copied to clipboard
common
fun copy(time: Time = this.time, offset: UtcOffset = this.offset): OffsetTime
Returns a copy of this time with the values of any individual components replaced by the new values specified.
fun copy(hour: Int = this.hour, minute: Int = this.minute, second: Int = this.second, nanosecond: Int = this.nanosecond, offset: UtcOffset = this.offset): OffsetTime
Returns a copy of this 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
minus
Link copied to clipboard
common
operator fun minus(duration: Duration): OffsetTime
operator fun minus(hours: IntHours): OffsetTime
operator fun minus(microseconds: IntMicroseconds): OffsetTime
operator fun minus(milliseconds: IntMilliseconds): OffsetTime
operator fun minus(minutes: IntMinutes): OffsetTime
operator fun minus(nanoseconds: IntNanoseconds): OffsetTime
operator fun minus(seconds: IntSeconds): OffsetTime
operator fun minus(hours: LongHours): OffsetTime
operator fun minus(microseconds: LongMicroseconds): OffsetTime
operator fun minus(milliseconds: LongMilliseconds): OffsetTime
operator fun minus(minutes: LongMinutes): OffsetTime
operator fun minus(nanoseconds: LongNanoseconds): OffsetTime
operator fun minus(seconds: LongSeconds): OffsetTime
plus
Link copied to clipboard
common
operator fun plus(duration: Duration): OffsetTime
operator fun plus(hours: IntHours): OffsetTime
operator fun plus(microseconds: IntMicroseconds): OffsetTime
operator fun plus(milliseconds: IntMilliseconds): OffsetTime
operator fun plus(minutes: IntMinutes): OffsetTime
operator fun plus(nanoseconds: IntNanoseconds): OffsetTime
operator fun plus(seconds: IntSeconds): OffsetTime
operator fun plus(hours: LongHours): OffsetTime
operator fun plus(microseconds: LongMicroseconds): OffsetTime
operator fun plus(milliseconds: LongMilliseconds): OffsetTime
operator fun plus(minutes: LongMinutes): OffsetTime
operator fun plus(nanoseconds: LongNanoseconds): OffsetTime
operator fun plus(seconds: LongSeconds): OffsetTime
toString
Link copied to clipboard
common
open override fun toString(): String
Converts this time to a string in ISO-8601 extended format.

Properties

hour
Link copied to clipboard
common
val hour: Int
The hour of the day.
minute
Link copied to clipboard
common
val minute: Int
The minute of the hour.
nanosecond
Link copied to clipboard
common
val nanosecond: Int
The nanosecond of the second.
nanosecondsSinceStartOfUtcDay
Link copied to clipboard
common
val nanosecondsSinceStartOfUtcDay: LongNanoseconds
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.
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.
time
Link copied to clipboard
common
val time: Time
The time of day.

Extensions

roundedDownTo
Link copied to clipboard
common
fun OffsetTime.roundedDownTo(unit: TimeUnit): OffsetTime
Returns this time, rounded down to match the precision of a given unit.
roundedDownToNearest
Link copied to clipboard
common
fun OffsetTime.roundedDownToNearest(increment: IntHours): OffsetTime
Returns this time, rounded down to the nearest hour that satisfies the increment.
fun OffsetTime.roundedDownToNearest(increment: IntMinutes): OffsetTime
Returns this time, rounded down to the nearest minute that satisfies the increment.
fun OffsetTime.roundedDownToNearest(increment: IntSeconds): OffsetTime
Returns this time, rounded down to the nearest second that satisfies the increment.
fun OffsetTime.roundedDownToNearest(increment: IntMilliseconds): OffsetTime
Returns this time, rounded down to the nearest millisecond that satisfies the increment.
fun OffsetTime.roundedDownToNearest(increment: IntMicroseconds): OffsetTime
Returns this time, rounded down to the nearest microsecond that satisfies the increment.
fun OffsetTime.roundedDownToNearest(increment: IntNanoseconds): OffsetTime
Returns this time, rounded down to the nearest nanosecond that satisfies the increment.
roundedTo
Link copied to clipboard
common
fun OffsetTime.roundedTo(unit: TimeUnit): OffsetTime
Returns this time, rounded to match the precision of a given unit.
roundedToNearest
Link copied to clipboard
common
fun OffsetTime.roundedToNearest(increment: IntHours): OffsetTime
Returns this time, rounded to the nearest hour that satisfies the increment.
fun OffsetTime.roundedToNearest(increment: IntMinutes): OffsetTime
Returns this time, rounded to the nearest minute that satisfies the increment.
fun OffsetTime.roundedToNearest(increment: IntSeconds): OffsetTime
Returns this time, rounded to the nearest second that satisfies the increment.
fun OffsetTime.roundedToNearest(increment: IntMilliseconds): OffsetTime
Returns this time, rounded to the nearest millisecond that satisfies the increment.
fun OffsetTime.roundedToNearest(increment: IntMicroseconds): OffsetTime
Returns this time, rounded to the nearest microsecond that satisfies the increment.
fun OffsetTime.roundedToNearest(increment: IntNanoseconds): OffsetTime
Returns this time, rounded to the nearest nanosecond that satisfies the increment.
roundedUpTo
Link copied to clipboard
common
fun OffsetTime.roundedUpTo(unit: TimeUnit): OffsetTime
Returns this time, rounded up to match the precision of a given unit.
roundedUpToNearest
Link copied to clipboard
common
fun OffsetTime.roundedUpToNearest(increment: IntHours): OffsetTime
Returns this time, rounded up to the nearest hour that satisfies the increment.
fun OffsetTime.roundedUpToNearest(increment: IntMinutes): OffsetTime
Returns this time, rounded up to the nearest minute that satisfies the increment.
fun OffsetTime.roundedUpToNearest(increment: IntSeconds): OffsetTime
Returns this time, rounded up to the nearest second that satisfies the increment.
fun OffsetTime.roundedUpToNearest(increment: IntMilliseconds): OffsetTime
Returns this time, rounded up to the nearest millisecond that satisfies the increment.
fun OffsetTime.roundedUpToNearest(increment: IntMicroseconds): OffsetTime
Returns this time, rounded up to the nearest microsecond that satisfies the increment.
fun OffsetTime.roundedUpToNearest(increment: IntNanoseconds): OffsetTime
Returns this time, rounded up to the nearest nanosecond that satisfies the increment.
toJavaOffsetTime
Link copied to clipboard
fun OffsetTime.toJavaOffsetTime(): OffsetTime
Converts this time to an equivalent Java OffsetTime.
toNSDateComponents
Link copied to clipboard
darwin
fun OffsetTime.toNSDateComponents(includeCalendar: Boolean = false): <ERROR CLASS>
Converts this time to an equivalent NSDateComponents object.
truncatedTo
Link copied to clipboard
common
fun OffsetTime.truncatedTo(unit: TimeUnit): OffsetTime
Returns this time, rounded down to match the precision of a given unit.