Skip to main content

parse_datetime_utc

Function parse_datetime_utc 

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

Parse a datetime string into a DateTime<Utc>.

Supports multiple formats:

  • RFC3339 (e.g., “2023-01-01T00:00:00Z”)
  • “%Y-%m-%d %H:%M:%S %z” (e.g., “2023-01-01 00:00:00 +0000”)
  • “%Y-%m-%d %H:%M:%S” naive (assumed UTC)

This is the canonical datetime parsing function for temporal operations like validAt. Using a single implementation ensures consistent behavior.