pub struct DayDate {
pub year: i32,
pub month: u8,
pub day: u8,
}Expand description
A civil (zoneless) calendar date, proleptic Gregorian. Ordered chronologically; Display and
DayDate::parse_iso speak ISO-8601 (YYYY-MM-DD).
Fields§
§year: i32§month: u8§day: u8Implementations§
Source§impl DayDate
impl DayDate
Sourcepub fn new(year: i32, month: u8, day: u8) -> Option<Self>
pub fn new(year: i32, month: u8, day: u8) -> Option<Self>
A validated date (month 1–12, day within the month, leap-aware); None otherwise.
Sourcepub fn today() -> Self
pub fn today() -> Self
Today’s date derived from the system clock in UTC (Day carries no time-zone database; an app that must roll the date at local midnight should compute it with its own zone source).
Sourcepub fn to_epoch_days(self) -> i64
pub fn to_epoch_days(self) -> i64
Days since 1970-01-01 (negative before). The numeric interchange form across native
boundaries (Event::Custom.num).
Sourcepub fn from_epoch_days(days: i64) -> Self
pub fn from_epoch_days(days: i64) -> Self
The date days after 1970-01-01 (inverse of DayDate::to_epoch_days).
Trait Implementations§
impl Copy for DayDate
impl Eq for DayDate
Source§impl Ord for DayDate
impl Ord for DayDate
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for DayDate
impl PartialOrd for DayDate
impl StructuralPartialEq for DayDate
Auto Trait Implementations§
impl Freeze for DayDate
impl RefUnwindSafe for DayDate
impl Send for DayDate
impl Sync for DayDate
impl Unpin for DayDate
impl UnsafeUnpin for DayDate
impl UnwindSafe for DayDate
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