pub struct DateTime<Tz: TimeZone> {
pub naive: NaiveDateTime,
pub time_zone: Tz,
}
Fields§
§naive: NaiveDateTime
§time_zone: Tz
Implementations§
Source§impl<Tz: TimeZone> DateTime<Tz>
impl<Tz: TimeZone> DateTime<Tz>
pub fn new( time_zone: Tz, year: i32, month: Month, day: u8, hour: u8, minute: u8, second: u8, ) -> Self
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) -> Self
pub fn to_timestamp(&self) -> Result<UnixTimestamp, LocalTimeConversionError>
pub fn convert_time_zone<NewTz: TimeZone>( &self, new_time_zone: NewTz, ) -> Result<DateTime<NewTz>, LocalTimeConversionError>
Source§impl<Tz: UnambiguousTimeZone> DateTime<Tz>
impl<Tz: UnambiguousTimeZone> DateTime<Tz>
pub fn to_unambiguous_timestamp(&self) -> UnixTimestamp
pub fn convert_unambiguous_time_zone<NewTz: TimeZone>( &self, new_time_zone: NewTz, ) -> DateTime<NewTz>
Trait Implementations§
Source§impl<Tz: UnambiguousTimeZone> From<DateTime<Tz>> for UnixTimestamp
impl<Tz: UnambiguousTimeZone> From<DateTime<Tz>> for UnixTimestamp
Source§impl<Tz: Default + TimeZone> From<UnixTimestamp> for DateTime<Tz>
impl<Tz: Default + TimeZone> From<UnixTimestamp> for DateTime<Tz>
Source§fn from(u: UnixTimestamp) -> Self
fn from(u: UnixTimestamp) -> Self
Converts to this type from the input type.
Source§impl<Tz: Ord + TimeZone> Ord for DateTime<Tz>
impl<Tz: Ord + TimeZone> 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 + TimeZone> PartialOrd for DateTime<Tz>
impl<Tz: PartialOrd + TimeZone> PartialOrd for DateTime<Tz>
impl<Tz: Copy + TimeZone> Copy for DateTime<Tz>
impl<Tz: Eq + TimeZone> Eq for DateTime<Tz>
impl<Tz: TimeZone> StructuralPartialEq for DateTime<Tz>
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