Esc

parse_format

procedureextensionsince 0.36.1Source
  • macOS: parse_format works on macOS
  • Linux: parse_format works on Linux
  • Windows: parse_format works on Windows
  • Wasm: parse_format works on Wasm

Reads the documented English directives; missing or conflicting required fields fail.

Signature

parse_format :: (
    $T: Type,
    pattern: string,
    text: string,
    options: Time_Options = .{}
) -> (T, Time_Error)
Example↗
wall, error := parse_format(Date_Time, "%Y-%m-%d %H:%M", "2024-03-10 02:30");
assert(error.kind == .NONE && wall.date.day == 10 && wall.time.minute == 30);
_, missing := parse_format(Date, "%m-%d", "03-10");
assert(missing.kind != .NONE);