toDateTimePeriod

fun String.toDateTimePeriod(): DateTimePeriod

Parses the ISO-8601 duration representation as a DateTimePeriod.

See DateTimePeriod.parse for examples.

See also

Throws

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


fun Duration.toDateTimePeriod(): DateTimePeriod

Constructs a DateTimePeriod from a Duration.

If the duration value is too big to be represented as a Long number of nanoseconds, the result will be Long.MAX_VALUE nanoseconds.