pub struct DatePerhapsTime {
pub date: NaiveDate,
pub time: Option<NaiveTime>,
pub tz: Option<Tz>,
}Expand description
Represents a date that may or may not include a time component, along with an optional timezone.
Fields§
§date: NaiveDateThe date component.
time: Option<NaiveTime>The optional time component.
tz: Option<Tz>The optional timezone.
Implementations§
Source§impl DatePerhapsTime
impl DatePerhapsTime
Sourcepub fn format(&self) -> String
pub fn format(&self) -> String
Creates a new DatePerhapsTime instance with the given date, optional time, and optional timezone.
Sourcepub fn to_dt_tz(
&self,
date_format: &str,
datetime_format: &str,
) -> (String, String)
pub fn to_dt_tz( &self, date_format: &str, datetime_format: &str, ) -> (String, String)
Converts the DatePerhapsTime to a string representation of date and timezone.
Sourcepub fn from_dt_tz(
dt: &str,
tz: &str,
date_format: &str,
datetime_format: &str,
) -> Option<DatePerhapsTime>
pub fn from_dt_tz( dt: &str, tz: &str, date_format: &str, datetime_format: &str, ) -> Option<DatePerhapsTime>
Parses a date or datetime string with an optional timezone into a DatePerhapsTime.
Trait Implementations§
Source§impl Clone for DatePerhapsTime
impl Clone for DatePerhapsTime
Source§fn clone(&self) -> DatePerhapsTime
fn clone(&self) -> DatePerhapsTime
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DatePerhapsTime
impl Debug for DatePerhapsTime
Source§impl From<DatePerhapsTime> for DatePerhapsTime
impl From<DatePerhapsTime> for DatePerhapsTime
Source§fn from(date: DatePerhapsTime) -> Self
fn from(date: DatePerhapsTime) -> Self
Converts to this type from the input type.
Source§impl From<DatePerhapsTime> for DatePerhapsTime
impl From<DatePerhapsTime> for DatePerhapsTime
Source§fn from(date: DatePerhapsTime) -> Self
fn from(date: DatePerhapsTime) -> Self
Converts to this type from the input type.
impl Copy for DatePerhapsTime
Auto Trait Implementations§
impl Freeze for DatePerhapsTime
impl RefUnwindSafe for DatePerhapsTime
impl Send for DatePerhapsTime
impl Sync for DatePerhapsTime
impl Unpin for DatePerhapsTime
impl UnwindSafe for DatePerhapsTime
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more