hour

actual val hour: Int(source)
expect val hour: Int(source)

Returns the hour-of-day (0..59) time component of this date/time value.

Samples

import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.test.*
fun main() { 
   //sampleStart 
   // Accessing the time components of a LocalDateTime value
val date = LocalDate(2024, 2, 15)
val time = LocalTime(hour = 16, minute = 48, second = 59, nanosecond = 999_999_999)
val dateTime = LocalDateTime(date, time)
check(dateTime.hour == dateTime.time.hour)
check(dateTime.minute == dateTime.time.minute)
check(dateTime.second == dateTime.time.second)
check(dateTime.nanosecond == dateTime.time.nanosecond) 
   //sampleEnd
}
actual val hour: Int(source)
actual val hour: Int(source)