pub struct DateTime<Tz>where
Tz: TimeZone,{
pub naive: NaiveDateTime,
pub time_zone: Tz,
}Fields§
§naive: NaiveDateTime§time_zone: TzImplementations§
Source§impl<Tz> DateTime<Tz>where
Tz: TimeZone,
impl<Tz> DateTime<Tz>where
Tz: TimeZone,
pub fn new( time_zone: Tz, year: i32, month: Month, day: u8, hour: u8, minute: u8, second: u8, ) -> DateTime<Tz>
pub fn year(&self) -> i32
pub fn month(&self) -> Month
pub fn day(&self) -> u8
pub fn hour(&self) -> u8
pub fn minute(&self) -> u8
pub fn second(&self) -> u8
pub fn day_of_the_week(&self) -> DayOfTheWeek
pub fn from_timestamp(t: UnixTimestamp, time_zone: Tz) -> DateTime<Tz>
pub fn to_timestamp(&self) -> Result<UnixTimestamp, LocalTimeConversionError>
pub fn convert_time_zone<NewTz>(
&self,
new_time_zone: NewTz,
) -> Result<DateTime<NewTz>, LocalTimeConversionError>where
NewTz: TimeZone,
Source§impl<Tz> DateTime<Tz>where
Tz: UnambiguousTimeZone,
impl<Tz> DateTime<Tz>where
Tz: UnambiguousTimeZone,
pub fn to_unambiguous_timestamp(&self) -> UnixTimestamp
pub fn convert_unambiguous_time_zone<NewTz>(
&self,
new_time_zone: NewTz,
) -> DateTime<NewTz>where
NewTz: TimeZone,
Trait Implementations§
Source§impl<Tz> From<DateTime<Tz>> for UnixTimestampwhere
Tz: UnambiguousTimeZone,
impl<Tz> From<DateTime<Tz>> for UnixTimestampwhere
Tz: UnambiguousTimeZone,
Source§fn from(datetime: DateTime<Tz>) -> UnixTimestamp
fn from(datetime: DateTime<Tz>) -> UnixTimestamp
Converts to this type from the input type.
Source§impl<Tz> From<UnixTimestamp> for DateTime<Tz>
impl<Tz> From<UnixTimestamp> for DateTime<Tz>
Source§fn from(u: UnixTimestamp) -> DateTime<Tz>
fn from(u: UnixTimestamp) -> DateTime<Tz>
Converts to this type from the input type.
Source§impl<Tz> Ord for DateTime<Tz>
impl<Tz> Ord for DateTime<Tz>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<Tz> PartialOrd for DateTime<Tz>where
Tz: PartialOrd + TimeZone,
impl<Tz> PartialOrd for DateTime<Tz>where
Tz: PartialOrd + TimeZone,
impl<Tz> Copy for DateTime<Tz>
impl<Tz> Eq for DateTime<Tz>
impl<Tz> StructuralPartialEq for DateTime<Tz>where
Tz: TimeZone,
Auto Trait Implementations§
impl<Tz> Freeze for DateTime<Tz>where
Tz: Freeze,
impl<Tz> RefUnwindSafe for DateTime<Tz>where
Tz: RefUnwindSafe,
impl<Tz> Send for DateTime<Tz>where
Tz: Send,
impl<Tz> Sync for DateTime<Tz>where
Tz: Sync,
impl<Tz> Unpin for DateTime<Tz>where
Tz: Unpin,
impl<Tz> UnwindSafe for DateTime<Tz>where
Tz: UnwindSafe,
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