pub struct DateTime { /* private fields */ }Expand description
Combined calendar date, time, and optional timezone offset.
Implementations§
Source§impl DateTime
impl DateTime
Sourcepub const fn new(date: Date, time: Time) -> DateTime
pub const fn new(date: Date, time: Time) -> DateTime
Create a new DateTime from date and time without timezone offset.
Sourcepub fn with_timezone_offset(
date: Date,
time: Time,
offset_minutes: i16,
) -> Result<DateTime, DateTimeError>
pub fn with_timezone_offset( date: Date, time: Time, offset_minutes: i16, ) -> Result<DateTime, DateTimeError>
Create a new DateTime with date, time, and timezone offset in minutes.
§Errors
Returns DateTimeError::InvalidTimezoneOffset if offset is not in -720..=840.
Sourcepub fn from_ymd_hms(
year: i32,
month: u8,
day: u8,
hour: u8,
minute: u8,
second: u8,
) -> Result<DateTime, DateTimeError>
pub fn from_ymd_hms( year: i32, month: u8, day: u8, hour: u8, minute: u8, second: u8, ) -> Result<DateTime, DateTimeError>
Convenience constructor from year, month, day, hour, minute, second.
Sourcepub const fn timezone_offset_minutes(&self) -> Option<i16>
pub const fn timezone_offset_minutes(&self) -> Option<i16>
Timezone offset in minutes, if specified.
Trait Implementations§
impl Copy for DateTime
impl Eq 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 UnsafeUnpin 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