pub struct Timestamp { /* private fields */ }Expand description
A basic data type for timestamps as used on Mensago. The type is timezone-agnostic as the platform operates on UTC time only. It can be used to just store dates or dates with times
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub fn from_str(data: &str) -> Option<Timestamp>
pub fn from_str(data: &str) -> Option<Timestamp>
Creates a new Timestamp from a correctly-formatted string, which is YYYYMMDDTHHMMSSZ.
Sourcepub fn from_datestr(date: &str) -> Option<Self>
pub fn from_datestr(date: &str) -> Option<Self>
Creates a timestamp object from just a date, which internally is stored as midnight on that date.
Sourcepub fn with_offset(&self, days: i64) -> Option<Timestamp>
pub fn with_offset(&self, days: i64) -> Option<Timestamp>
Returns the timestamp offset by the specified number of days
Sourcepub fn as_datestr(&self) -> &str
pub fn as_datestr(&self) -> &str
Returns the Timestamp as a string with only the date in the format YYYYMMDD.
Trait Implementations§
Source§impl PartialOrd for Timestamp
impl PartialOrd for Timestamp
impl StructuralPartialEq for Timestamp
Auto Trait Implementations§
impl Freeze for Timestamp
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnwindSafe for Timestamp
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