Date time with three parts: 1) offset, 2) Short zone 3) Region

use chrono::{DateTime, TimeZone, Utc};
use chrono_tz::{Europe::Paris, Tz};

fn main() {
let current_time = Utc::now();
let paris_time: DateTime = current_time.with_timezone(&Paris);

println!("{}", paris_time.format("%Y-%m-%d %H:%M:%S%.f %z %Z"));


2023-05-16 16:11:56.483770 +0200 CEST

2023-05-16 16:11:56.483770 +0200 CEST Europe::Paris

According to the chrono crate documentation, %Z in your formatted string will return an acronym like CEST, not a complete description like Europe/Paris. If you want this, you can use:

println!("{} {}", paris_time.format(...), Paris.to_string());

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.