method TimeOfDay.parse
Parses a time of day in ISO 8601 form or with a pattern (HH:mm).
Example:
use std.time { TimeOfDay }
fn main() io {
match TimeOfDay.parse("25:99") {
TimeOfDay t => print(t.show())
ParseError _ => print("invalid")
}
}Output
invalid
pub(api) static fn parse(text: str, format: TimeFormat | str = .Iso8601) -> TimeOfDay | ParseErrorSince. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
text | str |
format | TimeFormat | str = .Iso8601 |
Returns
Errors
ParseError@error- `ParseError` when the text does not match the format.
Effects
none declared (pure unless the body says otherwise)
Defined in: std/time/time.oxl:1258