toIsoString

Returns an ISO-8601 based string representation of this duration.

The returned value is presented in the format PThHmMs.fS, where h, m, s are the integer components of this duration (see toComponents) and f is a fractional part of second. Depending on the roundness of the value the fractional part can be formatted with either 0, 3, 6, or 9 decimal digits.

The infinite duration is represented as "PT9999999999999H" which is larger than any possible finite duration in Kotlin.

Negative durations are indicated with the sign - in the beginning of the returned string, for example, "-PT5M30S".

Since Kotlin

1.6

Samples