69 releases

0.6.1 Dec 30, 2023
0.5.10 Dec 29, 2023
0.5.7 May 11, 2023
0.5.6 Mar 24, 2023
0.2.1 Mar 27, 2022

#79 in Date and time

Download history 19439/week @ 2024-01-14 19700/week @ 2024-01-21 22621/week @ 2024-01-28 22533/week @ 2024-02-04 18672/week @ 2024-02-11 15753/week @ 2024-02-18 16332/week @ 2024-02-25 17939/week @ 2024-03-03 19717/week @ 2024-03-10 20531/week @ 2024-03-17 21905/week @ 2024-03-24 20335/week @ 2024-03-31 23056/week @ 2024-04-07 21763/week @ 2024-04-14 21726/week @ 2024-04-21 18851/week @ 2024-04-28

87,688 downloads per month
Used in 43 crates (6 directly)

Apache-2.0

2MB
40K SLoC

tzdb — Time Zone Database

GitHub Workflow Status Crates.io Minimum supported Rust version License: Apache-2.0

Static time zone information for tz-rs.

This crate provides all time zones found in the Time Zone Database.

Usage examples

let time_zone = tzdb::local_tz()?;       // tz::TimeZoneRef<'_>
let current_time = tzdb::now::local()?;  // tz::DateTime

// access by identifier
let time_zone = tzdb::time_zone::europe::KYIV;
let current_time = tzdb::now::in_tz(tzdb::time_zone::europe::KYIV)?;

// access by name
let time_zone = tzdb::tz_by_name("Europe/Berlin")?;
let current_time = tzdb::now::in_named("Europe/Berlin")?;

// names are case insensitive
let time_zone = tzdb::tz_by_name("ArCtIc/LongYeArByEn")?;
let current_time = tzdb::now::in_named("ArCtIc/LoNgYeArByEn")?;

// provide a default time zone
let current_time = tzdb::now::local_or(tzdb::time_zone::GMT)?;
let current_time = tzdb::now::in_named_or(tzdb::time_zone::GMT, "Some/City")?;

Feature flags

  • local (enabled by default) — enable functions to query the current system time

Dependencies

~0.2–5.5MB
~11K SLoC