pub struct Time { /* private fields */ }Expand description
The time portion of a DateTime.
Implementations§
Source§impl Time
impl Time
Sourcepub fn from_hmsz(hh: u32, mm: u32, ss: u32, tz: TzOffset) -> Self
pub fn from_hmsz(hh: u32, mm: u32, ss: u32, tz: TzOffset) -> Self
Create a time. Panics if it’s invalid.
Sourcepub fn from_hmsz_opt(hh: u32, mm: u32, ss: u32, tz: TzOffset) -> Option<Self>
pub fn from_hmsz_opt(hh: u32, mm: u32, ss: u32, tz: TzOffset) -> Option<Self>
Create a time. Returns None if it’s invalid for any reason.
Sourcepub fn offset(&self) -> TzOffset
pub fn offset(&self) -> TzOffset
Get the TzOffset. If None is returned, this represents a timestamp which did not
specify a timezone.
If using the chrono interop, None means you should attempt to convert to a chrono::NaiveDate
Sourcepub fn to_chrono_naive(&self) -> NaiveTime
Available on crate feature chrono only.
pub fn to_chrono_naive(&self) -> NaiveTime
chrono only.Strips out the timezone and returns a chrono::NaiveTime.
Trait Implementations§
Source§impl Timelike for Time
Available on crate feature chrono only.
impl Timelike for Time
Available on crate feature
chrono only.Source§fn nanosecond(&self) -> u32
fn nanosecond(&self) -> u32
Returns the number of nanoseconds since the whole non-leap second.
The range from 1,000,000,000 to 1,999,999,999 represents
the leap second.
Source§fn with_hour(&self, hour: u32) -> Option<Self>
fn with_hour(&self, hour: u32) -> Option<Self>
Makes a new value with the hour number changed. Read more
Source§fn with_minute(&self, min: u32) -> Option<Self>
fn with_minute(&self, min: u32) -> Option<Self>
Makes a new value with the minute number changed. Read more
Source§fn with_second(&self, sec: u32) -> Option<Self>
fn with_second(&self, sec: u32) -> Option<Self>
Makes a new value with the second number changed. Read more
Source§fn with_nanosecond(&self, _nano: u32) -> Option<Self>
fn with_nanosecond(&self, _nano: u32) -> Option<Self>
Makes a new value with nanoseconds since the whole non-leap second changed. Read more
Source§fn hour12(&self) -> (bool, u32)
fn hour12(&self) -> (bool, u32)
Returns the hour number from 1 to 12 with a boolean flag,
which is false for AM and true for PM.
Source§fn num_seconds_from_midnight(&self) -> u32
fn num_seconds_from_midnight(&self) -> u32
Returns the number of non-leap seconds past the last midnight. Read more
impl Copy for Time
impl Eq for Time
impl StructuralPartialEq for Time
Auto Trait Implementations§
impl Freeze for Time
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnwindSafe for Time
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