Skip to content

//core/io.islandtime/toTime

toTime

common

fun String.toTime(): Time

Converts a string to a Time.

The string is assumed to be an ISO-8601 time representation in extended format. For example, 05, 05:30, 05:30:00, or 05:30:00.123456789. The output of Time.toString can be safely parsed using this method.

Throws

DateTimeParseException if parsing fails
DateTimeException if the parsed time is invalid

common

fun String.toTime(parser: DateTimeParser, settings: DateTimeParserSettings = DateTimeParserSettings.DEFAULT): Time

Converts a string to a Time using a specific parser.

A set of predefined parsers can be found in DateTimeParsers.

Throws

DateTimeParseException if parsing fails
DateTimeException if the parsed time is invalid