parse

fun parse(input: String): SimpleTime?(source)

Parse input as HH:mm:ss or HH:mm:ss.nnnnnnnnn, returning null when it is not a time this formatter would have produced.

Returns null when:

  • the clock part does not hold exactly three :-separated fields,

  • any field or the fractional part is empty or holds anything but digits, a sign included,

  • hour is outside 0..23, or minute or second is outside 0..59,

  • the fractional part is outside 0..999999999.

The fractional part is read as a plain count of nanoseconds, so ".7" means seven nanoseconds, not seven tenths of a second. Round-tripping through format returns the zero-padded nine-digit form.

Field widths are not enforced, so "9:30:00" parses as 09:30:00. Any Unicode decimal digit is accepted, so Devanagari input such as "०९:३०:००" reads the same as its Latin form, and the two may be mixed. format always writes Latin digits. Leading and trailing whitespace is not trimmed, call String.trim() first when the input may carry any.