62 releases

0.5.7 May 11, 2023
0.5.6 Mar 24, 2023
0.5.3 Jan 1, 2023
0.5.2 Dec 22, 2022
0.2.1 Mar 27, 2022

#70 in Date and time

Download history 17324/week @ 2023-07-19 19685/week @ 2023-07-26 24384/week @ 2023-08-02 20717/week @ 2023-08-09 20044/week @ 2023-08-16 20329/week @ 2023-08-23 18662/week @ 2023-08-30 17567/week @ 2023-09-06 16578/week @ 2023-09-13 17825/week @ 2023-09-20 15741/week @ 2023-09-27 17477/week @ 2023-10-04 17828/week @ 2023-10-11 17429/week @ 2023-10-18 17403/week @ 2023-10-25 15921/week @ 2023-11-01

71,293 downloads per month
Used in 25 crates (4 directly)

Apache-2.0

3MB
47K 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, currently in the version 2023c (released 2023-03-28).

See the documentation for a full list the the contained time zones: https://docs.rs/tzdb/latest/tzdb/time_zone/index.html

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

  • fallback (enabled by default) — compile for unknown target platforms, too

Dependencies

~0.3–5.5MB
~12K SLoC