pub struct ZonedDateTime { /* private fields */ }Expand description
A UTC instant paired with the timezone it should be displayed in.
The instant field always carries UTC offset +00:00 internally.
local_parts() performs the TZ conversion on demand.
Implementations§
Source§impl ZonedDateTime
impl ZonedDateTime
pub fn new(instant: OffsetDateTime, tz: Tz) -> ZonedDateTime
pub fn instant(&self) -> OffsetDateTime
pub fn tz(&self) -> &Tz
Sourcepub fn add(&self, dur: Duration) -> ZonedDateTime
pub fn add(&self, dur: Duration) -> ZonedDateTime
Returns a new ZonedDateTime shifted forward (or backward) by dur.
The timezone is preserved; only the instant changes.
Sourcepub fn local_parts(&self) -> LocalParts
pub fn local_parts(&self) -> LocalParts
Extract wall-clock components in the stored timezone.
On the native feature, this uses time-tz to apply the correct UTC
offset including DST. Without native, components are returned in UTC
(mock / WASM build contexts where tests don’t exercise DST correctness).
Trait Implementations§
Source§impl Clone for ZonedDateTime
impl Clone for ZonedDateTime
Source§fn clone(&self) -> ZonedDateTime
fn clone(&self) -> ZonedDateTime
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ZonedDateTime
impl Debug for ZonedDateTime
Source§impl PartialEq for ZonedDateTime
impl PartialEq for ZonedDateTime
Source§fn eq(&self, other: &ZonedDateTime) -> bool
fn eq(&self, other: &ZonedDateTime) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for ZonedDateTime
impl StructuralPartialEq for ZonedDateTime
Auto Trait Implementations§
impl Freeze for ZonedDateTime
impl RefUnwindSafe for ZonedDateTime
impl Send for ZonedDateTime
impl Sync for ZonedDateTime
impl Unpin for ZonedDateTime
impl UnsafeUnpin for ZonedDateTime
impl UnwindSafe for ZonedDateTime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more