pub enum SessionTimeZone {
Utc,
Fixed(FixedOffset),
Named(Tz),
}Expand description
A validated session time zone.
Named zones use the bundled IANA rules. Fixed offsets intentionally remain available for legacy data whose source contract is an offset rather than a geographic zone.
Variants§
Utc
Coordinated Universal Time.
Fixed(FixedOffset)
An offset that does not vary by date.
Named(Tz)
A named IANA time zone with date-dependent rules.
Implementations§
Source§impl SessionTimeZone
impl SessionTimeZone
Sourcepub fn parse(value: &str) -> Result<Self>
pub fn parse(value: &str) -> Result<Self>
Parse UTC, a fixed +HH:MM/-HH:MM offset, or an IANA zone name.
Sourcepub fn civil_to_instant(self, civil: NaiveDateTime) -> Result<DateTime<Utc>>
pub fn civil_to_instant(self, civil: NaiveDateTime) -> Result<DateTime<Utc>>
Convert a civil date-time to one UTC instant.
DST gaps and overlaps fail closed because either would require the engine to invent policy not present in the value.
Sourcepub fn instant_to_civil(self, instant: DateTime<Utc>) -> NaiveDateTime
pub fn instant_to_civil(self, instant: DateTime<Utc>) -> NaiveDateTime
Convert a UTC instant to its unambiguous civil representation.
Sourcepub fn parse_instant(self, value: &str) -> Result<DateTime<Utc>>
pub fn parse_instant(self, value: &str) -> Result<DateTime<Utc>>
Parse a TIMESTAMPTZ input. An explicit input offset wins; otherwise the civil text is interpreted using this session zone.
Sourcepub fn format_instant(self, instant: DateTime<Utc>) -> String
pub fn format_instant(self, instant: DateTime<Utc>) -> String
Render an instant with the offset selected by this zone at that date.
Trait Implementations§
Source§impl Clone for SessionTimeZone
impl Clone for SessionTimeZone
Source§fn clone(&self) -> SessionTimeZone
fn clone(&self) -> SessionTimeZone
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more