UTC

Returns the time zone with the fixed UTC+0 offset.

The id of this time zone is "Z".

Samples

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

fun main() { 
   //sampleStart 
   // Using the UTC time zone for arithmetic operations
val localDateTime = LocalDate(2023, 6, 2).atTime(12, 30)
val instant = localDateTime.toInstant(TimeZone.UTC)
check(instant == Instant.parse("2023-06-02T12:30:00Z"))
val newInstant = instant.plus(5, DateTimeUnit.DAY, TimeZone.UTC)
check(newInstant == Instant.parse("2023-06-07T12:30:00Z"))
val newLocalDateTime = newInstant.toLocalDateTime(TimeZone.UTC)
check(newLocalDateTime == LocalDate(2023, 6, 7).atTime(12, 30)) 
   //sampleEnd
}