pub struct DateTime { /* private fields */ }
Implementations§
Source§impl DateTime
impl DateTime
Sourcepub fn now_utc() -> Self
pub fn now_utc() -> Self
Create a new DateTime
with the current date and time in UTC.
assert!(DateTime::now_utc().year() >= 2022);
pub fn hour(&self) -> u8
pub fn minute(&self) -> u8
pub fn second(&self) -> u8
pub fn day(&self) -> u8
pub fn year(&self) -> u64
pub fn unix_timestamp(&self) -> u64
pub fn unix_timestamp_millis(&self) -> u128
pub fn unix_timestamp_nanos(&self) -> u128
pub fn month(&self) -> Month
pub fn weekday(&self) -> Weekday
Trait Implementations§
Source§impl From<SystemTime> for DateTime
impl From<SystemTime> for DateTime
Source§fn from(system_time: SystemTime) -> Self
fn from(system_time: SystemTime) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for DateTime
impl RefUnwindSafe for DateTime
impl Send for DateTime
impl Sync for DateTime
impl Unpin for DateTime
impl UnwindSafe for DateTime
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