Struct sys_datetime::Datetime
source · pub struct Datetime { /* private fields */ }
Expand description
Datetime
§Example
let mut dt = Datetime::default();
dt.add_years(1970).add_months(1).add_days(1);
dt.add_seconds(Datetime::timestamp().as_secs() as i64);
let now = Datetime::now();
assert!(dt == now);
Implementations§
source§impl Datetime
impl Datetime
sourcepub fn add_months(&mut self, months: i64) -> &mut Self
pub fn add_months(&mut self, months: i64) -> &mut Self
plus months
sourcepub fn add_hours(&mut self, hours: i64) -> &mut Self
pub fn add_hours(&mut self, hours: i64) -> &mut Self
plus hours
let mut dt = Datetime::now();
dt.add_hours(8);
println!("{}", dt);
sourcepub fn add_minutes(&mut self, minutes: i64) -> &mut Self
pub fn add_minutes(&mut self, minutes: i64) -> &mut Self
plus minutes
sourcepub fn add_seconds(&mut self, seconds: i64) -> &mut Self
pub fn add_seconds(&mut self, seconds: i64) -> &mut Self
plus seconds
pub fn year(&self) -> i64
pub fn month(&self) -> i64
pub fn day(&self) -> i64
pub fn hour(&self) -> i64
pub fn minute(&self) -> i64
pub fn second(&self) -> i64
Trait Implementations§
source§impl<'de> Deserialize<'de> for Datetime
impl<'de> Deserialize<'de> for Datetime
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialOrd for Datetime
impl PartialOrd for Datetime
impl Copy for Datetime
impl StructuralPartialEq for Datetime
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)