//core/io.islandtime/OffsetTime
OffsetTime¶
@Serializable(with = OffsetTimeIsoSerializer::class)
class OffsetTime(val time: Time, val offset: UtcOffset)
A time of day with an offset from UTC.
Throws¶
DateTimeException | if the offset is invalid |
Constructors¶
OffsetTime | common constructor(hour: Int, minute: Int, second: Int = 0, nanosecond: Int = 0, offset: UtcOffset) Creates an OffsetTime. constructor(time: Time, offset: UtcOffset) Creates an OffsetTime by combining a Time and UtcOffset. |
Types¶
Name | Summary |
---|---|
Companion | common object Companion |
Properties¶
Name | Summary |
---|---|
hour | common val hour: Int The hour of the day. |
minute | common val minute: Int The minute of the hour. |
nanosecond | common val nanosecond: Int The nanosecond of the second. |
nanosecondsSinceStartOfUtcDay | common val nanosecondsSinceStartOfUtcDay: Nanoseconds 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 | common val offset: UtcOffset The offset from UTC. |
second | common val second: Int The second of the minute. |
time | common val time: Time The time of day. |
Functions¶
Name | Summary |
---|---|
adjustedTo | 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 | common operator fun compareTo(other: OffsetTime): Int Compares to another OffsetTime based on timeline order, ignoring offset differences. |
copy | common 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 Returns a copy of this time with the values of any individual components replaced by the new values specified. |
equals | common open operator override fun equals(other: Any?): Boolean |
hashCode | common open override fun hashCode(): Int |
minus | common operator fun minus(duration: Duration): OffsetTime common operator fun minus(hours: Hours): OffsetTime Returns this time with hours subtracted from it. common operator fun minus(microseconds: Microseconds): OffsetTime Returns this time with microseconds subtracted from it. common operator fun minus(milliseconds: Milliseconds): OffsetTime Returns this time with milliseconds subtracted from it. common operator fun minus(minutes: Minutes): OffsetTime Returns this time with minutes subtracted from it. common operator fun minus(nanoseconds: Nanoseconds): OffsetTime Returns this time with nanoseconds subtracted from it. common operator fun minus(seconds: Seconds): OffsetTime Returns this time with seconds subtracted from it. common operator fun minus(duration: Duration): OffsetTime Returns this time with duration subtracted from it. |
plus | common operator fun plus(duration: Duration): OffsetTime common operator fun plus(hours: Hours): OffsetTime Returns this time with hours added to it. common operator fun plus(microseconds: Microseconds): OffsetTime Returns this time with microseconds added to it. common operator fun plus(milliseconds: Milliseconds): OffsetTime Returns this time with milliseconds added to it. common operator fun plus(minutes: Minutes): OffsetTime Returns this time with minutes added to it. common operator fun plus(nanoseconds: Nanoseconds): OffsetTime Returns this time with nanoseconds added to it. common operator fun plus(seconds: Seconds): OffsetTime Returns this time with seconds added to it. common operator fun plus(duration: Duration): OffsetTime Returns this time with duration added to it. |
roundedDownTo | common fun OffsetTime.roundedDownTo(unit: TimeUnit): OffsetTime Returns this time, rounded down to match the precision of a given unit. |
roundedDownToNearest | common fun OffsetTime.roundedDownToNearest(increment: Hours): OffsetTime Returns this time, rounded down to the nearest hour that satisfies the increment. common fun OffsetTime.roundedDownToNearest(increment: Microseconds): OffsetTime Returns this time, rounded down to the nearest microsecond that satisfies the increment. common fun OffsetTime.roundedDownToNearest(increment: Milliseconds): OffsetTime Returns this time, rounded down to the nearest millisecond that satisfies the increment. common fun OffsetTime.roundedDownToNearest(increment: Minutes): OffsetTime Returns this time, rounded down to the nearest minute that satisfies the increment. common fun OffsetTime.roundedDownToNearest(increment: Nanoseconds): OffsetTime Returns this time, rounded down to the nearest nanosecond that satisfies the increment. common fun OffsetTime.roundedDownToNearest(increment: Seconds): OffsetTime Returns this time, rounded down to the nearest second that satisfies the increment. |
roundedTo | common fun OffsetTime.roundedTo(unit: TimeUnit): OffsetTime 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. |
roundedToNearest | common fun OffsetTime.roundedToNearest(increment: Hours): OffsetTime Returns this time, rounded to the nearest hour that satisfies the increment. If the time is halfway between increments, it will be rounded up. common fun OffsetTime.roundedToNearest(increment: Microseconds): 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. common fun OffsetTime.roundedToNearest(increment: Milliseconds): 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. common fun OffsetTime.roundedToNearest(increment: Minutes): 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. common fun OffsetTime.roundedToNearest(increment: Nanoseconds): 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. common fun OffsetTime.roundedToNearest(increment: Seconds): 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. |
roundedUpTo | common fun OffsetTime.roundedUpTo(unit: TimeUnit): OffsetTime Returns this time, rounded up to match the precision of a given unit. |
roundedUpToNearest | common fun OffsetTime.roundedUpToNearest(increment: Hours): OffsetTime Returns this time, rounded up to the nearest hour that satisfies the increment. common fun OffsetTime.roundedUpToNearest(increment: Microseconds): OffsetTime Returns this time, rounded up to the nearest microsecond that satisfies the increment. common fun OffsetTime.roundedUpToNearest(increment: Milliseconds): OffsetTime Returns this time, rounded up to the nearest millisecond that satisfies the increment. common fun OffsetTime.roundedUpToNearest(increment: Minutes): OffsetTime Returns this time, rounded up to the nearest minute that satisfies the increment. common fun OffsetTime.roundedUpToNearest(increment: Nanoseconds): OffsetTime Returns this time, rounded up to the nearest nanosecond that satisfies the increment. common fun OffsetTime.roundedUpToNearest(increment: Seconds): OffsetTime Returns this time, rounded up to the nearest second that satisfies the increment. |
toJavaOffsetTime | jvm fun OffsetTime.toJavaOffsetTime(): OffsetTime Converts this time to an equivalent Java OffsetTime . |
toNSDateComponents | darwin fun OffsetTime.toNSDateComponents(includeCalendar: Boolean = false): <Error class: unknown class> Converts this time to an equivalent NSDateComponents object. |
toString | common open override fun toString(): String Converts this time to a string in ISO-8601 extended format. For example, 17:31:45.923452091-04:00 or 02:30Z . |
truncatedTo | common fun OffsetTime.truncatedTo(unit: TimeUnit): OffsetTime Returns this time, rounded down to match the precision of a given unit. |