Local Time
Constructs a LocalTime instance from the given time components.
The supported ranges of components:
hour
0..23
minute
0..59
second
0..59
nanosecond
0..999_999_999
Throws
if any parameter is out of range.
Samples
import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.random.*
import kotlin.test.*
fun main() {
//sampleStart
// Constructing a LocalTime using its constructor
val time = LocalTime(8, 30, 15, 123_456_789)
check(time.hour == 8)
check(time.minute == 30)
check(time.second == 15)
check(time.nanosecond == 123_456_789)
val timeWithoutSeconds = LocalTime(23, 30)
check(timeWithoutSeconds.hour == 23)
check(timeWithoutSeconds.minute == 30)
check(timeWithoutSeconds.second == 0)
check(timeWithoutSeconds.nanosecond == 0)
//sampleEnd
}