Skip to main content

parse_iso8601

Function parse_iso8601 

Source
pub fn parse_iso8601(s: &str) -> Result<DateTime<Utc>, TimestampError>
Expand description

Parses an ISO 8601 datetime string into a UTC datetime.

Accepts timezone-aware strings like "2026-02-17T15:30:00Z" and "2026-02-17T15:30:00+05:00", as well as naive strings like "2026-02-17T15:30:00". Timezone-aware inputs are normalized to UTC; naive inputs are assumed UTC.

§Errors

Returns TimestampError::UnrecognizedFormat if the string is not valid ISO 8601.