to Local Time
Builds a LocalTime from the fields in this DateTimeComponents.
This method uses the following fields:
hour, hourOfAmPm, and amPm
second (default value is 0)
nanosecond (default value is 0)
Throws
if hours or minutes are not present, if any of the fields are invalid, or hourOfAmPm and amPm are inconsistent with hour.
Samples
import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.test.*
fun main() {
//sampleStart
// Obtaining a LocalTime from the parsed data
val rfc1123Input = "Sun, 06 Nov 1994 08:49:37 +0300"
val parsed = DateTimeComponents.Formats.RFC_1123.parse(rfc1123Input)
val localTime = parsed.toLocalTime()
check(localTime == LocalTime(8, 49, 37))
//sampleEnd
}