Trait DateTimeBehavior

Source
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§

Source

fn as_date(&self) -> Option<&NaiveDate>

Source

fn as_time(&self) -> Option<&NaiveTime>

Source

fn as_date_time(&self) -> Option<&DateTime<Utc>>

Source

fn year(&self) -> Option<i32>

Source

fn month(&self) -> Option<u32>

Source

fn day(&self) -> Option<u32>

Source

fn hour(&self) -> Option<u32>

Source

fn minute(&self) -> Option<u32>

Source

fn second(&self) -> Option<u32>

Source

fn timestamp(&self) -> Option<i64>

Source

fn timezone(&self) -> Option<Utc>

Source

fn to_iso8601(&self) -> String

Source

fn to_rfc3339(&self) -> String

Source

fn add_duration(&self, duration: TimeDelta) -> Option<Self>
where Self: Sized,

Source

fn subtract_duration(&self, duration: TimeDelta) -> Option<Self>
where Self: Sized,

Source

fn duration_between(&self, other: &Self) -> Option<TimeDelta>

Source

fn from_ymd_opt(year: i32, month: u32, day: u32) -> Self

Source

fn with_ymd_and_hms( year: i32, month: u32, day: u32, hour: u32, min: u32, sec: u32, ) -> Self

Source

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.

Implementors§