pub enum DateTime {
Date(NaiveDate),
Time(NaiveTime),
DateTime(ChDateTime<Utc>),
}
Expand description
Enum representing a date, time, or date-time value.
§Variants
Date(NaiveDate)
- Represents a date without timezone information.Time(NaiveTime)
- Represents a time without date and timezone information.DateTime(ChDateTime<chrono::Utc>)
- Represents a date-time with timezone information.
Variants§
Trait Implementations§
source§impl DateTimeBehavior for DateTime
impl DateTimeBehavior for DateTime
fn as_date(&self) -> Option<&NaiveDate>
fn as_time(&self) -> Option<&NaiveTime>
fn as_date_time(&self) -> Option<&ChDateTime<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: Duration) -> Option<Self>
fn subtract_duration(&self, duration: Duration) -> Option<Self>
fn duration_between(&self, other: &DateTime) -> Option<Duration>
fn from_ymd_opt(year: i32, month: u32, day: u32) -> DateTime
fn with_ymd_and_hms( year: i32, month: u32, day: u32, hour: u32, min: u32, sec: u32, ) -> DateTime
fn now() -> DateTime
source§impl From<DateTime<Utc>> for DateTime
impl From<DateTime<Utc>> for DateTime
source§fn from(value: ChDateTime<Utc>) -> Self
fn from(value: ChDateTime<Utc>) -> Self
Converts to this type from the input type.
source§impl From<LocalResult<DateTime<Utc>>> for DateTime
impl From<LocalResult<DateTime<Utc>>> for DateTime
source§fn from(value: LocalResult<ChDateTime<Utc>>) -> Self
fn from(value: LocalResult<ChDateTime<Utc>>) -> Self
Converts to this type from the input type.
source§impl From<LocalResult<NaiveDate>> for DateTime
impl From<LocalResult<NaiveDate>> for DateTime
source§fn from(value: LocalResult<NaiveDate>) -> Self
fn from(value: LocalResult<NaiveDate>) -> Self
Converts to this type from the input type.
source§impl From<LocalResult<NaiveTime>> for DateTime
impl From<LocalResult<NaiveTime>> for DateTime
source§fn from(value: LocalResult<NaiveTime>) -> Self
fn from(value: LocalResult<NaiveTime>) -> Self
Converts to this type from the input type.
source§impl PartialEq for DateTime
impl PartialEq for DateTime
source§impl PartialOrd for DateTime
impl PartialOrd for DateTime
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl ToValueBehavior for DateTime
impl ToValueBehavior for DateTime
impl PrimitiveType for DateTime
impl StructuralPartialEq for DateTime
Auto Trait Implementations§
impl Freeze for DateTime
impl RefUnwindSafe for DateTime
impl Send for DateTime
impl Sync for DateTime
impl Unpin for DateTime
impl UnwindSafe for DateTime
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)