Skip to main content

parse_flexible_datetime

Function parse_flexible_datetime 

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

Parse a datetime string flexibly, handling:

  • RFC3339 with Z: 2024-06-15T10:30:00Z
  • RFC3339 with offset: 2024-06-15T10:30:00+00:00
  • Naive (no timezone): 2024-06-15T10:30:00 (assumed UTC)
  • With fractional seconds: 2024-06-15T10:30:00.123456