pub trait TimestampLike: Clone + PartialOrd + Add<Duration, Output = Self> + Sub<Duration, Output = Self> + Sub<Output = Duration> + for<'a> TryInto<Datum<'a>, Error = TimestampError> + for<'a> TryFrom<Datum<'a>, Error = ()> + TimeLike + DateLike {
Show 28 methods // Required methods fn new(date: NaiveDate, time: NaiveTime) -> Self; fn timestamp(&self) -> i64; fn timestamp_subsec_micros(&self) -> u32; fn date(&self) -> NaiveDate; fn date_time(&self) -> NaiveDateTime; fn from_date_time(dt: NaiveDateTime) -> Self; fn timezone_offset(&self) -> &'static str; fn timezone_hours(&self) -> &'static str; fn timezone_minutes(&self) -> &'static str; fn timezone_name(&self, caps: bool) -> &'static str; fn checked_add_signed(self, rhs: Duration) -> Option<Self>; fn checked_sub_signed(self, rhs: Duration) -> Option<Self>; // Provided methods fn weekday0(&self) -> usize { ... } fn iso_year_ce(&self) -> u32 { ... } fn extract_epoch<T>(&self) -> T where T: DecimalLike { ... } fn truncate_microseconds(&self) -> Self { ... } fn truncate_milliseconds(&self) -> Self { ... } fn truncate_second(&self) -> Self { ... } fn truncate_minute(&self) -> Self { ... } fn truncate_hour(&self) -> Self { ... } fn truncate_day(&self) -> Self { ... } fn truncate_week(&self) -> Result<Self, TimestampError> { ... } fn truncate_month(&self) -> Self { ... } fn truncate_quarter(&self) -> Self { ... } fn truncate_year(&self) -> Self { ... } fn truncate_decade(&self) -> Self { ... } fn truncate_century(&self) -> Self { ... } fn truncate_millennium(&self) -> Self { ... }
}
Expand description

A timestamp with both a date and a time component, but not necessarily a timezone component.

Required Methods§

source

fn new(date: NaiveDate, time: NaiveTime) -> Self

source

fn timestamp(&self) -> i64

source

fn timestamp_subsec_micros(&self) -> u32

source

fn date(&self) -> NaiveDate

Return the date component of the timestamp

source

fn date_time(&self) -> NaiveDateTime

Return the date and time of the timestamp

source

fn from_date_time(dt: NaiveDateTime) -> Self

Return the date and time of the timestamp

source

fn timezone_offset(&self) -> &'static str

Returns a string representing the timezone’s offset from UTC.

source

fn timezone_hours(&self) -> &'static str

Returns a string representing the hour portion of the timezone’s offset from UTC.

source

fn timezone_minutes(&self) -> &'static str

Returns a string representing the minute portion of the timezone’s offset from UTC.

source

fn timezone_name(&self, caps: bool) -> &'static str

Returns the abbreviated name of the timezone with the specified capitalization.

source

fn checked_add_signed(self, rhs: Duration) -> Option<Self>

Adds given Duration to the current date and time.

source

fn checked_sub_signed(self, rhs: Duration) -> Option<Self>

Subtracts given Duration from the current date and time.

Provided Methods§

source

fn weekday0(&self) -> usize

Returns the weekday as a usize between 0 and 6, where 0 represents Sunday and 6 represents Saturday.

source

fn iso_year_ce(&self) -> u32

Like chrono::Datelike::year_ce, but works on the ISO week system.

source

fn extract_epoch<T>(&self) -> T
where T: DecimalLike,

source

fn truncate_microseconds(&self) -> Self

source

fn truncate_milliseconds(&self) -> Self

source

fn truncate_second(&self) -> Self

source

fn truncate_minute(&self) -> Self

source

fn truncate_hour(&self) -> Self

source

fn truncate_day(&self) -> Self

source

fn truncate_week(&self) -> Result<Self, TimestampError>

source

fn truncate_month(&self) -> Self

source

fn truncate_quarter(&self) -> Self

source

fn truncate_year(&self) -> Self

source

fn truncate_decade(&self) -> Self

source

fn truncate_century(&self) -> Self

source

fn truncate_millennium(&self) -> Self

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl TimestampLike for DateTime<Utc>

source§

fn new(date: NaiveDate, time: NaiveTime) -> Self

source§

fn date(&self) -> NaiveDate

source§

fn date_time(&self) -> NaiveDateTime

source§

fn from_date_time(dt: NaiveDateTime) -> Self

source§

fn timestamp(&self) -> i64

source§

fn timestamp_subsec_micros(&self) -> u32

source§

fn timezone_offset(&self) -> &'static str

source§

fn timezone_hours(&self) -> &'static str

source§

fn timezone_minutes(&self) -> &'static str

source§

fn timezone_name(&self, caps: bool) -> &'static str

source§

fn checked_add_signed(self, rhs: Duration) -> Option<Self>

source§

fn checked_sub_signed(self, rhs: Duration) -> Option<Self>

source§

impl TimestampLike for NaiveDateTime

source§

fn new(date: NaiveDate, time: NaiveTime) -> Self

source§

fn date(&self) -> NaiveDate

source§

fn date_time(&self) -> NaiveDateTime

source§

fn from_date_time(dt: NaiveDateTime) -> NaiveDateTime

source§

fn timestamp(&self) -> i64

source§

fn timestamp_subsec_micros(&self) -> u32

source§

fn timezone_offset(&self) -> &'static str

source§

fn timezone_hours(&self) -> &'static str

source§

fn timezone_minutes(&self) -> &'static str

source§

fn timezone_name(&self, _caps: bool) -> &'static str

source§

fn checked_add_signed(self, rhs: Duration) -> Option<Self>

source§

fn checked_sub_signed(self, rhs: Duration) -> Option<Self>

Implementors§