toDateTimeInterval

Returns this interval with the precision reduced to only the local date and time.

fun String.toDateTimeInterval(): DateTimeInterval

Converts 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:

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

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

  • 1990-01-04T03/..

  • ../..

  • (empty string)

Throws

fun String.toDateTimeInterval(parser: GroupedDateTimeParser, settings: DateTimeParserSettings = DateTimeParserSettings.DEFAULT): DateTimeInterval

Converts a string to a DateTimeInterval using a specific parser.

A set of predefined parsers can be found in DateTimeParsers.

Throws