//core/io.islandtime/toUtcOffset
toUtcOffset¶
common
fun String.toUtcOffset(): UtcOffset
Converts a string to a UtcOffset.
The string is assumed to be an ISO-8601 UTC offset representation in extended format. For example, Z
, +05
, or -04:30
. The output of UtcOffset.toString can be safely parsed using this method.
Throws¶
DateTimeParseException | if parsing fails |
DateTimeException | if the parsed UTC offset is invalid |
common
fun String.toUtcOffset(parser: DateTimeParser, settings: DateTimeParserSettings = DateTimeParserSettings.DEFAULT): UtcOffset
Converts a string to a UtcOffset using a specific parser.
A set of predefined parsers can be found in DateTimeParsers.
Throws¶
DateTimeParseException | if parsing fails |
DateTimeException | if the parsed UTC offset is invalid |