pub struct Date(i32);
Expand description
ISO 8601 Date values. The inner representation is a signed 32 bit integer that represents the days since “1970-01-01 00:00:00 UTC” (UNIX Epoch).
Tuple Fields§
§0: i32
Implementations§
source§impl Date
impl Date
sourcepub fn from_str_utc(s: &str) -> Result<Self>
pub fn from_str_utc(s: &str) -> Result<Self>
Try parsing a string into Date
with UTC timezone.
sourcepub fn from_str(s: &str, timezone: Option<&Timezone>) -> Result<Self>
pub fn from_str(s: &str, timezone: Option<&Timezone>) -> Result<Self>
Try parsing a string into Date
with given timezone.
pub fn new(val: i32) -> Self
pub fn val(&self) -> i32
pub fn to_chrono_date(&self) -> Option<NaiveDate>
sourcepub fn as_formatted_string(
self,
pattern: &str,
timezone: Option<&Timezone>,
) -> Result<Option<String>>
pub fn as_formatted_string( self, pattern: &str, timezone: Option<&Timezone>, ) -> Result<Option<String>>
Format Date for given format and timezone.
If tz==None
, the server default timezone will used.
pub fn to_secs(&self) -> i64
sourcepub fn add_year_month(&self, interval: IntervalYearMonth) -> Option<Date>
pub fn add_year_month(&self, interval: IntervalYearMonth) -> Option<Date>
Adds given IntervalYearMonth to the current date.
sourcepub fn add_day_time(&self, interval: IntervalDayTime) -> Option<Date>
pub fn add_day_time(&self, interval: IntervalDayTime) -> Option<Date>
Adds given IntervalDayTime to the current date.
sourcepub fn add_month_day_nano(&self, interval: IntervalMonthDayNano) -> Option<Date>
pub fn add_month_day_nano(&self, interval: IntervalMonthDayNano) -> Option<Date>
Adds given IntervalMonthDayNano to the current date.
sourcepub fn sub_year_month(&self, interval: IntervalYearMonth) -> Option<Date>
pub fn sub_year_month(&self, interval: IntervalYearMonth) -> Option<Date>
Subtracts given IntervalYearMonth to the current date.
sourcepub fn sub_day_time(&self, interval: IntervalDayTime) -> Option<Date>
pub fn sub_day_time(&self, interval: IntervalDayTime) -> Option<Date>
Subtracts given IntervalDayTime to the current date.
sourcepub fn sub_month_day_nano(&self, interval: IntervalMonthDayNano) -> Option<Date>
pub fn sub_month_day_nano(&self, interval: IntervalMonthDayNano) -> Option<Date>
Subtracts given IntervalMonthDayNano to the current date.
pub fn negative(&self) -> Self
Trait Implementations§
source§impl<'de> Deserialize<'de> for Date
impl<'de> Deserialize<'de> for Date
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for Date
impl Ord for Date
source§impl PartialOrd for Date
impl PartialOrd for Date
impl Copy for Date
impl Eq for Date
impl StructuralPartialEq for Date
Auto Trait Implementations§
impl Freeze for Date
impl RefUnwindSafe for Date
impl Send for Date
impl Sync for Date
impl Unpin for Date
impl UnwindSafe for Date
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CallHasher for T
impl<T> CallHasher for T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request