Trait mz_repr::adt::timestamp::TimestampLike
source · 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§
fn new(date: NaiveDate, time: NaiveTime) -> Self
fn timestamp(&self) -> i64
fn timestamp_subsec_micros(&self) -> u32
sourcefn date_time(&self) -> NaiveDateTime
fn date_time(&self) -> NaiveDateTime
Return the date and time of the timestamp
sourcefn from_date_time(dt: NaiveDateTime) -> Self
fn from_date_time(dt: NaiveDateTime) -> Self
Return the date and time of the timestamp
sourcefn timezone_offset(&self) -> &'static str
fn timezone_offset(&self) -> &'static str
Returns a string representing the timezone’s offset from UTC.
sourcefn timezone_hours(&self) -> &'static str
fn timezone_hours(&self) -> &'static str
Returns a string representing the hour portion of the timezone’s offset from UTC.
sourcefn timezone_minutes(&self) -> &'static str
fn timezone_minutes(&self) -> &'static str
Returns a string representing the minute portion of the timezone’s offset from UTC.
sourcefn timezone_name(&self, caps: bool) -> &'static str
fn timezone_name(&self, caps: bool) -> &'static str
Returns the abbreviated name of the timezone with the specified capitalization.
sourcefn checked_add_signed(self, rhs: Duration) -> Option<Self>
fn checked_add_signed(self, rhs: Duration) -> Option<Self>
Adds given Duration to the current date and time.
sourcefn checked_sub_signed(self, rhs: Duration) -> Option<Self>
fn checked_sub_signed(self, rhs: Duration) -> Option<Self>
Subtracts given Duration from the current date and time.
Provided Methods§
sourcefn weekday0(&self) -> usize
fn weekday0(&self) -> usize
Returns the weekday as a usize
between 0 and 6, where 0 represents
Sunday and 6 represents Saturday.
sourcefn iso_year_ce(&self) -> u32
fn iso_year_ce(&self) -> u32
Like chrono::Datelike::year_ce
, but works on the ISO week system.
fn extract_epoch<T>(&self) -> Twhere
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
Object Safety§
This trait is not object safe.