Closed amokfa closed 1 year ago
This code fails with the following error:
use anyhow::*; use time::{OffsetDateTime}; pub fn parse_timestamp(timestamp: &str) -> Result<OffsetDateTime> { OffsetDateTime::parse(timestamp, time::macros::format_description!("[year]-[month]-[day] [hour]:[minute]:[second].[subsecond]")) .context("invalid date format") } fn main() { let timestamp = "2023-04-30 08:00:55.207"; dbg!(parse_timestamp(timestamp)); }
Error:
Error { context: "invalid date format", source: TryFromParsed( InsufficientInformation, ), },
I presume you figured it out since you closed the issue, but the reason it failed is because there is no UTC offset specified.
This code fails with the following error:
Error: