Datetime from text
Convert a text to a datetime object.
The input must be an RFC 3339 datetime, e.g.
2024-04-12T15:30:12.123456+02:00. The T separator is required — a
space-separated datetime like 2024-04-12 15:30:12 fails the step
(InvalidDateTimeFormat). Two relaxations are applied when parsing:
- ISO 8601-style offsets without a colon (e.g.
+0200) are accepted and normalized to+02:00. - An input without any timezone indication is assumed to be UTC (a
Zis appended before parsing).
Input
Textrequired
The text to convert to a datetime.
Output
Datetime
The datetime object. It carries the original input string unchanged — the value is validated but not normalized.