toOffsetDateTimeInterval

Converts this interval to an OffsetDateTimeInterval.

While similar to ZonedDateTime, an OffsetDateTime representation is unaffected by time zone rule changes or database differences between systems, making it better suited for use cases involving persistence or network transfer.

fun String.toOffsetDateTimeInterval(): OffsetDateTimeInterval

Converts a string to an OffsetDateTimeInterval.

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

Examples:

  • 1990-01-04T03-05/1991-08-30T15:30:05.123-04:00

  • ../1991-08-30T15:30:05.123-04:00

  • 1990-01-04T03-05/..

  • ../..

  • (empty string)

Throws

fun String.toOffsetDateTimeInterval(parser: GroupedDateTimeParser, settings: DateTimeParserSettings = DateTimeParserSettings.DEFAULT): OffsetDateTimeInterval

Converts a string to an OffsetDateTimeInterval using a specific parser.

A set of predefined parsers can be found in DateTimeParsers.

Throws