OxL Reference

method TimeOfDay.parse

Parses a time of day in ISO 8601 form or with a pattern (HH:mm).

Example:

oxl✓ checked in CI
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 | ParseError

Since. 1.0.0-beta

Parameters

NameType
textstr
formatTimeFormat | str = .Iso8601

Returns

TimeOfDay

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

See also