to Local Date Time
Builds a LocalDateTime 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)
Also, dayOfWeek is checked for consistency with the other fields.
See also
Throws
if any of the required fields are not present, any of the fields are invalid, or there's inconsistency.
Samples
import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.test.*
fun main() {
//sampleStart
// Obtaining a LocalDateTime from the parsed data
val rfc1123Input = "Sun, 06 Nov 1994 08:49:37 +0300"
val parsed = DateTimeComponents.Formats.RFC_1123.parse(rfc1123Input)
val localDateTime = parsed.toLocalDateTime()
check(localDateTime == LocalDateTime(1994, 11, 6, 8, 49, 37))
//sampleEnd
}