minute

The minute-of-hour component.

Throws

during assignment if the value is outside the 0..99 range.

Samples

import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   // Formatting and parsing a time in complex scenarios
val format = DateTimeComponents.Format {
    hour(); char(':'); minute(); char(':'); second(); char('.'); secondFraction(1, 9)
}
val formattedTime = format.format {
    setTime(LocalTime(3, 46, 58, 123_456_789))
    check(hour == 3)
    check(minute == 46)
    check(second == 58)
    check(nanosecond == 123_456_789)
    check(hourOfAmPm == 3)
    check(amPm == AmPmMarker.AM)
}
check(formattedTime == "03:46:58.123456789")
val parsedTime = format.parse("03:46:58.123456789")
check(parsedTime.toLocalTime() == LocalTime(3, 46, 58, 123_456_789))
check(parsedTime.hour == 3)
check(parsedTime.minute == 46)
check(parsedTime.second == 58)
check(parsedTime.nanosecond == 123_456_789)
check(parsedTime.hourOfAmPm == null)
check(parsedTime.amPm == null) 
   //sampleEnd
}