method Ldt.parse
Parses a local date-time in ISO 8601 form or with a pattern.
Example:
use std.time { LocalDateTime }
fn main() io {
print("{LocalDateTime.parse("2026-11-03T18:30")!.toIso()}")
}Output
2026-11-03T18:30:00
pub(api) static fn parse(text: str, format: TimeFormat | str = .Iso8601) -> Ldt | ParseErrorSince. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
text | str |
format | TimeFormat | str = .Iso8601 |
Returns
Ldt
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:1782