Enum purp_value::types::datetime::DateTime
source · 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§
Implementations§
source§impl DateTime
impl DateTime
pub fn as_date(&self) -> Option<&NaiveDate>
pub fn as_time(&self) -> Option<&NaiveTime>
pub fn as_date_time(&self) -> Option<&ChDateTime<Utc>>
pub fn year(&self) -> Option<i32>
pub fn month(&self) -> Option<u32>
pub fn day(&self) -> Option<u32>
pub fn hour(&self) -> Option<u32>
pub fn minute(&self) -> Option<u32>
pub fn second(&self) -> Option<u32>
pub fn timestamp(&self) -> Option<i64>
pub fn timezone(&self) -> Option<Utc>
pub fn to_iso8601(&self) -> String
pub fn to_rfc3339(&self) -> String
pub fn add_duration(&self, duration: Duration) -> Option<Self>
pub fn subtract_duration(&self, duration: Duration) -> Option<Self>
pub fn duration_between(&self, other: &DateTime) -> Option<Duration>
Trait Implementations§
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.