parse

expect fun parse(isoString: String): Instant

Parses a string that represents an instant in ISO-8601 format including date and time components and the mandatory time zone offset and returns the parsed Instant value.

Supports the following ways of specifying the time zone offset:

  • the Z designator for the UTC+0 time zone,

  • a custom time zone offset specified with +hh, or +hh:mm, or +hh:mm:ss (with + being replaced with - for the negative offsets)

Examples of instants in the ISO-8601 format:

  • 2020-08-30T18:43:00Z

  • 2020-08-30T18:43:00.500Z

  • 2020-08-30T18:43:00.123456789Z

  • 2020-08-30T18:40:00+03:00

  • 2020-08-30T18:40:00+03:30:20

The string is considered to represent time on the UTC-SLS time scale instead of UTC. In practice, this means that, even if there is a leap second on the given day, it will not affect how the time is parsed, even if it's in the last 1000 seconds of the day. Instead, even if there is a negative leap second on the given day, 23:59:59 is still considered valid time. 23:59:60 is invalid on UTC-SLS, so parsing it will fail.

Throws

if the text cannot be parsed or the boundaries of Instant are exceeded.

actual fun parse(isoString: String): Instant
actual fun parse(isoString: String): Instant
actual fun parse(isoString: String): Instant