toOffsetDateTime

Returns the combined date, time, and UTC offset.

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 ZonedDateTime.toOffsetDateTime(): OffsetDateTime

Converts a string to an OffsetDateTime.

The string is assumed to be an ISO-8601 date-time with the UTC offset in extended format. For example, 2019-05-30T02:30+01:00. The output of OffsetDateTime.toString can be safely parsed using this method.

fun String.toOffsetDateTime(): OffsetDateTime

Converts a string to an OffsetDateTime using a specific parser.

A set of predefined parsers can be found in DateTimeParsers.

Any custom parser must be capable of supplying the fields necessary to resolve a Date, Time and UtcOffset.

fun String.toOffsetDateTime(parser: DateTimeParser, settings: DateTimeParserSettings): OffsetDateTime