Expand description
get the IANA time zone for the current system
This small utility crate provides the
get_timezone()
function.
// Get the current time zone as a string.
let tz_str = iana_time_zone::get_timezone()?;
println!("The current time zone is: {}", tz_str);
The resulting string can be parsed to a
chrono-tz::Tz
variant like this:
ⓘ
let tz_str = iana_time_zone::get_timezone()?;
let tz: chrono_tz::Tz = tz_str.parse()?;
Enums§
- Error types
Functions§
- Get the current IANA time zone as a string.