OxL Reference

method Date.parse

Parses ISO 8601 (.Iso8601, the default) or a pattern: Date.parse(s, "dd.MM.yyyy").

Example:

oxl✓ checked in CI
use std.time { Date }

fn main() io {
  print("{Date.parse("03.11.2026", "dd.MM.yyyy")!.toIso()}")
  match Date.parse("2026-13-40") {
    Date d => print(d.toIso())
    ParseError _ => print("invalid")
  }
}
Output
2026-11-03
invalid
pub(api) static fn parse(text: str, format: TimeFormat | str = .Iso8601) -> Date | ParseError

Since. 1.0.0-beta

Parameters

NameType
textstr
formatTimeFormat | str = .Iso8601

Returns

Date

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:1573

See also