LocalTime

@Serializable(with = LocalTimeIso8601Serializer::class)
actual class LocalTime(hour: Int, minute: Int, second: Int, nanosecond: Int) : Comparable<LocalTime> (source)
@Serializable(with = LocalTimeIso8601Serializer::class)
expect class LocalTime(hour: Int, minute: Int, second: Int = 0, nanosecond: Int = 0) : Comparable<LocalTime> (source)

The time part of LocalDateTime.

This class represents time-of-day without a referencing a specific date. To reconstruct a full LocalDateTime, representing civil date and time, LocalTime needs to be combined with LocalDate via LocalDate.atTime or LocalTime.atDate.

Also, LocalTime does not reference a particular time zone. Therefore, even on the same date, LocalTime denotes different moments of time. For example, 18:43 happens at different moments in Berlin and in Tokyo.

The arithmetic on LocalTime values is not provided, since without accounting for the time zone transitions it may give misleading results.

@Serializable(with = LocalTimeIso8601Serializer::class)
actual class LocalTime(hour: Int, minute: Int, second: Int, nanosecond: Int) : Comparable<LocalTime> (source)
@Serializable(with = LocalTimeIso8601Serializer::class)
actual class LocalTime(val hour: Int, val minute: Int, val second: Int, val nanosecond: Int) : Comparable<LocalTime> (source)

Constructors

Link copied to clipboard
actual constructor(hour: Int, minute: Int, second: Int, nanosecond: Int)
expect constructor(hour: Int, minute: Int, second: Int = 0, nanosecond: Int = 0)

Constructs a LocalTime instance from the given time components.

actual constructor(hour: Int, minute: Int, second: Int, nanosecond: Int)
actual constructor(hour: Int, minute: Int, second: Int, nanosecond: Int)

Types

Link copied to clipboard
actual object Companion
expect object Companion
actual object Companion
actual object Companion
Link copied to clipboard
actual object Formats
expect object Formats

A collection of predefined formats for parsing and formatting LocalDateTime values.

actual object Formats
actual object Formats

Properties

Link copied to clipboard
actual val hour: Int
expect val hour: Int

Returns the hour-of-day time component of this time value.

actual val hour: Int
actual val hour: Int
Link copied to clipboard
actual val minute: Int
expect val minute: Int

Returns the minute-of-hour time component of this time value.

actual val minute: Int
actual val minute: Int
Link copied to clipboard
actual val nanosecond: Int
expect val nanosecond: Int

Returns the nanosecond-of-second time component of this time value.

actual val nanosecond: Int
actual val nanosecond: Int
Link copied to clipboard
actual val second: Int
expect val second: Int

Returns the second-of-minute time component of this time value.

actual val second: Int
actual val second: Int

Functions

Link copied to clipboard

Combines this time's components with the specified LocalDate components into a LocalDateTime value.

fun LocalTime.atDate(year: Int, monthNumber: Int, dayOfMonth: Int = 0): LocalDateTime
fun LocalTime.atDate(year: Int, month: Month, dayOfMonth: Int = 0): LocalDateTime

Combines this time's components with the specified date components into a LocalDateTime value.

Link copied to clipboard
actual open operator override fun compareTo(other: LocalTime): Int
expect open operator override fun compareTo(other: LocalTime): Int

Compares this time value with the other time value. Returns zero if this value is equal to the other, a negative number if this value occurs earlier in the course of a typical day than the other, and a positive number if this value occurs later in the course of a typical day than the other.

actual open operator override fun compareTo(other: LocalTime): Int
actual open operator override fun compareTo(other: LocalTime): Int
equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
open operator override fun equals(other: Any?): Boolean
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard

Formats this value using the given format. Equivalent to calling DateTimeFormat.format on format with this.

hashCode
Link copied to clipboard
open override fun hashCode(): Int
open override fun hashCode(): Int
open override fun hashCode(): Int
Link copied to clipboard
Link copied to clipboard
actual fun toMillisecondOfDay(): Int
expect fun toMillisecondOfDay(): Int

Returns the time as a millisecond of a day, in 0 until 24 * 60 * 60 * 1_000.

actual fun toMillisecondOfDay(): Int
actual fun toMillisecondOfDay(): Int
Link copied to clipboard
actual fun toNanosecondOfDay(): Long
expect fun toNanosecondOfDay(): Long

Returns the time as a nanosecond of a day, in 0 until 24 * 60 * 60 * 1_000_000_000.

actual fun toNanosecondOfDay(): Long
actual fun toNanosecondOfDay(): Long
Link copied to clipboard
actual fun toSecondOfDay(): Int
expect fun toSecondOfDay(): Int

Returns the time as a second of a day, in 0 until 24 * 60 * 60.

actual fun toSecondOfDay(): Int
actual fun toSecondOfDay(): Int
Link copied to clipboard
actual open override fun toString(): String
expect open override fun toString(): String

Converts this time value to the extended ISO-8601 string representation.

actual open override fun toString(): String
actual open override fun toString(): String