You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to parse a string with TZ-Information including seconds (+00:00:00) fails (see below 3rd element in the vector).
use chrono::DateTime; // chrono 0.4.38
fn main() {
// from ...
// https://docs.rs/chrono/latest/chrono/format/strftime/index.html
// ... under "TIME ZONE SPECIFIERS:"
// %::z | +09:30:00 | Offset from the local time to UTC with seconds.
let f = "%Y-%m-%dT%H:%M:%S%::z";
// Testvalues
let tooshort_ok_toolong = [
"2023-01-02T23:24:25+01", // really to short -> fails
"2023-01-02T23:24:25+01:00", // although to short but is Ok ?
"2023-01-02T23:24:25+01:30:01", // _should_ run but fails
];
for s in tooshort_ok_toolong.iter() {
let t = DateTime::parse_from_str(s, f);
println!("Parse {:<28} > {} > {:?}", s, f, t);
}
let dt = chrono::offset::Utc::now();
println!("\nFormatting \"{}\" ok > {} > {}",dt, f, dt.format(f));
}
Trying to parse a string with TZ-Information including seconds (+00:00:00) fails (see below 3rd element in the vector).
Running the program gives ...
The text was updated successfully, but these errors were encountered: