offset Minutes Of Hour
The amount of minutes that don't add to a whole hour in the UTC offset, in the range 0; 59.
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 UTC offset in complex scenarios
val format = DateTimeComponents.Format { offset(UtcOffset.Formats.ISO) }
val formattedOffset = format.format {
setOffset(UtcOffset(-3, -30, -15))
check(offsetHours == 3)
check(offsetMinutesOfHour == 30)
check(offsetSecondsOfMinute == 15)
check(offsetIsNegative == true)
}
check(formattedOffset == "-03:30:15")
val parsedOffset = format.parse("-03:30:15")
check(parsedOffset.toUtcOffset() == UtcOffset(-3, -30, -15))
check(parsedOffset.offsetHours == 3)
check(parsedOffset.offsetMinutesOfHour == 30)
check(parsedOffset.offsetSecondsOfMinute == 15)
check(parsedOffset.offsetIsNegative == true)
//sampleEnd
}