Struct tzdata::Timezone [] [src]

pub struct Timezone {
    pub name: String,
    // some fields omitted
}

A named timezone from the IANA Time Zone Database

Example

use  tzdata::*;

let now = now_utc();
for tzname in &["Europe/Paris", "America/New_York", "Asia/Seoul"] {
    let tz = Timezone::new(tzname).unwrap();
    let now = tz.localize(now);
    println!("now is {} in {}", now.rfc3339(), tz.name);
}

Fields

name: String

The timezone name e.g. Europe/Paris.

Methods

impl Timezone
[src]

fn new(timezone: &str) -> Result<Self>

Try to load a new Timezone. It assumes that the zoneinfo data are located under /usr/share/zoneinfo.

fn localize(&self, t: Tm) -> Tm

Project a Tm from UTC into the Timezone. Panics if not in UTC timezone.