Trait chrono::Datelike
[−]
[src]
pub trait Datelike: Sized { fn year(&self) -> i32; fn month(&self) -> u32; fn month0(&self) -> u32; fn day(&self) -> u32; fn day0(&self) -> u32; fn ordinal(&self) -> u32; fn ordinal0(&self) -> u32; fn weekday(&self) -> Weekday; fn isoweekdate(&self) -> (i32, u32, Weekday); fn with_year(&self, year: i32) -> Option<Self>; fn with_month(&self, month: u32) -> Option<Self>; fn with_month0(&self, month0: u32) -> Option<Self>; fn with_day(&self, day: u32) -> Option<Self>; fn with_day0(&self, day0: u32) -> Option<Self>; fn with_ordinal(&self, ordinal: u32) -> Option<Self>; fn with_ordinal0(&self, ordinal0: u32) -> Option<Self>; fn year_ce(&self) -> (bool, u32) { ... } fn num_days_from_ce(&self) -> i32 { ... } }
The common set of methods for date component.
Required Methods
fn year(&self) -> i32
Returns the year number.
fn month(&self) -> u32
Returns the month number starting from 1.
fn month0(&self) -> u32
Returns the month number starting from 0.
fn day(&self) -> u32
Returns the day of month starting from 1.
fn day0(&self) -> u32
Returns the day of month starting from 0.
fn ordinal(&self) -> u32
Returns the day of year starting from 1.
fn ordinal0(&self) -> u32
Returns the day of year starting from 0.
fn weekday(&self) -> Weekday
Returns the day of week.
fn isoweekdate(&self) -> (i32, u32, Weekday)
Returns the ISO week date: an adjusted year, week number and day of week. The adjusted year may differ from that of the calendar date.
fn with_year(&self, year: i32) -> Option<Self>
Makes a new value with the year number changed.
Returns None
when the resulting value would be invalid.
fn with_month(&self, month: u32) -> Option<Self>
Makes a new value with the month number (starting from 1) changed.
Returns None
when the resulting value would be invalid.
fn with_month0(&self, month0: u32) -> Option<Self>
Makes a new value with the month number (starting from 0) changed.
Returns None
when the resulting value would be invalid.
fn with_day(&self, day: u32) -> Option<Self>
Makes a new value with the day of month (starting from 1) changed.
Returns None
when the resulting value would be invalid.
fn with_day0(&self, day0: u32) -> Option<Self>
Makes a new value with the day of month (starting from 0) changed.
Returns None
when the resulting value would be invalid.
fn with_ordinal(&self, ordinal: u32) -> Option<Self>
Makes a new value with the day of year (starting from 1) changed.
Returns None
when the resulting value would be invalid.
fn with_ordinal0(&self, ordinal0: u32) -> Option<Self>
Makes a new value with the day of year (starting from 0) changed.
Returns None
when the resulting value would be invalid.
Provided Methods
fn year_ce(&self) -> (bool, u32)
Returns the absolute year number starting from 1 with a boolean flag, which is false when the year predates the epoch (BCE/BC) and true otherwise (CE/AD).
fn num_days_from_ce(&self) -> i32
Returns the number of days since January 1, 1 (Day 1) in the proleptic Gregorian calendar.