toString

actual open override fun toString(): String(source)
expect open override fun toString(): String(source)

Converts this UTC offset to the extended ISO 8601 string representation, for example, +02:30 or Z.

See also

for the format details.

for the dual operation: obtaining UtcOffset from a string.

for formatting using a custom format.

Samples

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

fun main() { 
   //sampleStart 
   // Converting a UtcOffset to a string
check(UtcOffset.parse("+01:30:00").toString() == "+01:30")
check(UtcOffset(hours = 1, minutes = 30).toString() == "+01:30")
check(UtcOffset(seconds = 5400).toString() == "+01:30") 
   //sampleEnd
}
actual open override fun toString(): String(source)
actual open override fun toString(): String(source)