Struct packedtime_rs::EpochDays
source · [−]pub struct EpochDays(_);Expand description
A date represented as the number of days since the unix epoch 1970-01-01.
Implementations
sourceimpl EpochDays
impl EpochDays
pub fn new(epoch_days: i32) -> Self
pub fn days(&self) -> i32
sourcepub fn from_ymd(year: i32, month: i32, day: i32) -> Self
pub fn from_ymd(year: i32, month: i32, day: i32) -> Self
Convert a date to the number of days since the unix epoch 1970-01-01. See https://github.com/ThreeTen/threetenbp/blob/master/src/main/java/org/threeten/bp/LocalDate.java#L1634
sourcepub fn to_ymd(&self) -> (i32, i32, i32)
pub fn to_ymd(&self) -> (i32, i32, i32)
Convert the number of days since the unix epoch into a (year, month, day) tuple. See https://github.com/ThreeTen/threetenbp/blob/master/src/main/java/org/threeten/bp/LocalDate.java#L281 The resulting month and day values are 1-based.
pub fn from_timestamp_millis(ts: i64) -> Self
pub fn from_timestamp_millis_float(ts: f64) -> Self
pub fn to_timestamp_millis(&self) -> i64
pub fn to_timestamp_millis_float(&self) -> f64
sourcepub fn add_months(&self, months: i32) -> Self
pub fn add_months(&self, months: i32) -> Self
Adds the given number of months to epoch_days.
If the day would be out of range for the resulting month and the CLAMP_DAYS flag is set
then the date will be clamped to the end of the month.
For example: 2022-01-31 + 1month => 2022-02-28
pub fn date_trunc_month(&self) -> Self
pub fn date_trunc_year(&self) -> Self
pub fn date_trunc_quarter(&self) -> Self
pub fn extract_year(&self) -> i32
pub fn extract_month(&self) -> i32
pub fn extract_quarter(&self) -> i32
pub fn extract_day_of_month(&self) -> i32
Trait Implementations
sourceimpl From<EpochDays> for PackedTimestamp
impl From<EpochDays> for PackedTimestamp
sourceimpl PartialEq<EpochDays> for EpochDays
impl PartialEq<EpochDays> for EpochDays
impl Copy for EpochDays
impl Eq for EpochDays
impl StructuralEq for EpochDays
impl StructuralPartialEq for EpochDays
Auto Trait Implementations
impl RefUnwindSafe for EpochDays
impl Send for EpochDays
impl Sync for EpochDays
impl Unpin for EpochDays
impl UnwindSafe for EpochDays
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more