Skip to content

Kijewski/tzdb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jan 16, 2025
fee6a8b · Jan 16, 2025
Jan 16, 2025
Dec 16, 2024
Jan 16, 2025
Sep 15, 2024
Jan 16, 2025
Sep 15, 2024
Jan 16, 2025
Jan 16, 2025
Jul 21, 2022
Aug 1, 2022
Dec 30, 2023
Sep 15, 2024
Sep 15, 2024
Jul 21, 2022
Jan 16, 2025
Sep 15, 2024
Sep 15, 2024
Sep 15, 2024
Sep 15, 2024
Dec 11, 2024
Jan 16, 2025
Jan 16, 2025

Repository files navigation

tzdb — Time Zone Database

GitHub Workflow Status Crates.io docs.rs 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
  • now (enabled by default) — enable functions to query the current system time
  • std (enabled by default, now and local) — enable the use of features in the std crate
  • alloc (enabled by std) — enable the use of features in the alloc crate