core / io.islandtime.ranges / kotlin.String / toDateTimeInterval

toDateTimeInterval

(iosArm64) fun String.toDateTimeInterval(): DateTimeInterval
(iosX64) fun String.toDateTimeInterval(): DateTimeInterval
(jvm) fun String.toDateTimeInterval(): DateTimeInterval
(macosX64) fun String.toDateTimeInterval(): DateTimeInterval

Convert a string to a DateTimeInterval.

The string is assumed to be an ISO-8601 time interval representation in extended format. The output of DateTimeInterval.toString can be safely parsed using this method.

Examples:

Exceptions

DateTimeParseException - if parsing fails

DateTimeException - if the parsed time is invalid

(iosArm64) fun String.toDateTimeInterval(parser: GroupedDateTimeParser): DateTimeInterval
(iosX64) fun String.toDateTimeInterval(parser: GroupedDateTimeParser): DateTimeInterval
(jvm) fun String.toDateTimeInterval(parser: GroupedDateTimeParser): DateTimeInterval
(macosX64) fun String.toDateTimeInterval(parser: GroupedDateTimeParser): DateTimeInterval

Convert a string to a DateTimeInterval using a specific parser.

A set of predefined parsers can be found in DateTimeParsers.

Exceptions

DateTimeParseException - if parsing fails

DateTimeException - if the parsed time is invalid