pub enum Tz {
Show 22 variants
UtcWet = 0,
BstCet = 3_600,
CestEet = 7_200,
EestAst = 10_800,
Ist = 19_800,
JstKst = 32_400,
CstAwstSstHkt = 28_800,
Acst = 34_200,
AestChst = 36_000,
Lwst = 37_800,
NzstFjt = 43_200,
Sast = -39_600,
Hast = -36_000,
Alst = -32_400,
Pst = -28_800,
Mst = -25_200,
Censt = -21_600,
Est = -18_000,
AtstClt = -14_400,
Nst = -12_600,
BtAtArtUyt = -10_800,
IctWib = 25_200,
}Variants§
UtcWet = 0
Universal Standard Time (+00:00) and Western European Time (+00:00)
BstCet = 3_600
British Summer Time (+01:00) and Central European Time (+01:00)
CestEet = 7_200
Central European Summer Time (+02:00) and Eastern European Time (+02:00)
EestAst = 10_800
Eastern European Summer Time (+03:00) and Arabian Standard Time (+03:00)
Ist = 19_800
Indian Standard Time (+05:30)
JstKst = 32_400
Japan Standard Time (+09:00) and Korea Standard Time (+09:00)
CstAwstSstHkt = 28_800
China Standard Time (+08:00), Australian Western Standard Time (+08:00), Singapore Standard Time (+08:00) and Hong Kong Time (+08:00)
Acst = 34_200
Australian Central Standard Time (+09:30)
AestChst = 36_000
Australian Eastern Standard Time (+10:00), Chamorro Standard Time (+10:00)
Lwst = 37_800
Lord Howe Standard Time (+10:30)
NzstFjt = 43_200
New Zealand Standard Time (+12:00) and Fiji Time (+12:00)
Sast = -39_600
Samoa Standard Time (-11:00)
Hast = -36_000
Hawaii-Aleutian Standard Time (-10:00)
Alst = -32_400
Alaska Standard Time (-09:00)
Pst = -28_800
Pacific Standard Time (-08:00)
Mst = -25_200
Mountain Standard Time (-07:00)
Censt = -21_600
Central Standard Time (-06:00)
Est = -18_000
Eastern Standard Time (-05:00)
AtstClt = -14_400
Atlantic Standard Time (-04:00) and Chile Time (-04:00)
Nst = -12_600
Newfoundland Standard Time (-03:30)
BtAtArtUyt = -10_800
Brazil Time (-03:00), Fernando de Noronha Time (-02:00), Argentina Time (-03:00) and Uruguay Time (-03:00)
IctWib = 25_200
Indochina Time (+07:00) and Western Indonesian Time (+07:00)
Implementations§
Source§impl Tz
impl Tz
Sourcepub fn offset(&self) -> i32
pub fn offset(&self) -> i32
Returns the offset in seconds from UTC.
§Examples
use thetime::Tz;
println!("{}", Tz::UtcWet.offset()); // 0
println!("{}", Tz::BstCet.offset()); // 3600
println!("{}", Tz::CestEet.offset()); // 7200Sourcepub fn offset_str(&self) -> String
pub fn offset_str(&self) -> String
Returns the offset in seconds from UTC as a string.
§Examples
use thetime::Tz;
println!("{}", Tz::UtcWet.offset_str()); // +00:00
println!("{}", Tz::BstCet.offset_str()); // +01:00
println!("{}", Tz::CestEet.offset_str()); // +02:00Sourcepub fn name(&self) -> String
pub fn name(&self) -> String
Returns the name of the timezone.
§Examples
use thetime::Tz;
println!("{}", Tz::UtcWet.name()); // UTC/WET
println!("{}", Tz::BstCet.name()); // BST/CET
println!("{}", Tz::CestEet.name()); // CEST/EETSourcepub fn from_name<T: ToString>(name: T) -> Option<Self>
pub fn from_name<T: ToString>(name: T) -> Option<Self>
Returns the timezone from the name.
§Examples
use thetime::Tz;
println!("{:?}", Tz::from_name("UTC/WET")); // Some(UtcWet)
println!("{:?}", Tz::from_name("BST/CET")); // Some(BstCet)
println!("{:?}", Tz::from_name("CEST/EET")); // Some(CestEet)
println!("{:?}", Tz::from_name("Life? Don't talk to me about life!")); // NoneSourcepub fn from_offset(offset: i32) -> Option<Self>
pub fn from_offset(offset: i32) -> Option<Self>
Returns the timezone from the offset.
§Examples
use thetime::Tz;
println!("{:?}", Tz::from_offset(0)); // Some(UtcWet)
println!("{:?}", Tz::from_offset(3600)); // Some(BstCet)
println!("{:?}", Tz::from_offset(7200)); // Some(CestEet)
println!("{:?}", Tz::from_offset(123456)); // Nonepub fn from_offset_str(offset: &str) -> Option<Self>
Sourcepub fn offset_struct<T: Time>(&self, time: T) -> T
pub fn offset_struct<T: Time>(&self, time: T) -> T
Offsets the provided struct by the timezone.
§Examples
use thetime::{Time, System, Tz};
println!("{:?}", Tz::Acst.offset_struct(System::now()));