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()}")
}Вывод
2026-11-03T18:30:00
pub(api) static fn parse(text: str, format: TimeFormat | str = .Iso8601) -> Ldt | ParseErrorС версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
text | str |
format | TimeFormat | str = .Iso8601 |
Возвращает
Ldt
Ошибки
ParseError@error- `ParseError` when the text does not match the format.
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/time/time.oxl:1782