pub trait DateTimeBehavior {
Show 19 methods
// Required methods
fn as_date(&self) -> Option<&NaiveDate>;
fn as_time(&self) -> Option<&NaiveTime>;
fn as_date_time(&self) -> Option<&DateTime<Utc>>;
fn year(&self) -> Option<i32>;
fn month(&self) -> Option<u32>;
fn day(&self) -> Option<u32>;
fn hour(&self) -> Option<u32>;
fn minute(&self) -> Option<u32>;
fn second(&self) -> Option<u32>;
fn timestamp(&self) -> Option<i64>;
fn timezone(&self) -> Option<Utc>;
fn to_iso8601(&self) -> String;
fn to_rfc3339(&self) -> String;
fn add_duration(&self, duration: TimeDelta) -> Option<Self>
where Self: Sized;
fn subtract_duration(&self, duration: TimeDelta) -> Option<Self>
where Self: Sized;
fn duration_between(&self, other: &Self) -> Option<TimeDelta>;
fn from_ymd_opt(year: i32, month: u32, day: u32) -> Self;
fn with_ymd_and_hms(
year: i32,
month: u32,
day: u32,
hour: u32,
min: u32,
sec: u32,
) -> Self;
fn now() -> Self;
}Required Methods§
fn as_date(&self) -> Option<&NaiveDate>
fn as_time(&self) -> Option<&NaiveTime>
fn as_date_time(&self) -> Option<&DateTime<Utc>>
fn year(&self) -> Option<i32>
fn month(&self) -> Option<u32>
fn day(&self) -> Option<u32>
fn hour(&self) -> Option<u32>
fn minute(&self) -> Option<u32>
fn second(&self) -> Option<u32>
fn timestamp(&self) -> Option<i64>
fn timezone(&self) -> Option<Utc>
fn to_iso8601(&self) -> String
fn to_rfc3339(&self) -> String
fn add_duration(&self, duration: TimeDelta) -> Option<Self>where
Self: Sized,
fn subtract_duration(&self, duration: TimeDelta) -> Option<Self>where
Self: Sized,
fn duration_between(&self, other: &Self) -> Option<TimeDelta>
fn from_ymd_opt(year: i32, month: u32, day: u32) -> Self
fn with_ymd_and_hms( year: i32, month: u32, day: u32, hour: u32, min: u32, sec: u32, ) -> Self
fn now() -> Self
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.