pub struct DateTime { /* private fields */ }Implementations§
Source§impl DateTime
impl DateTime
pub fn new( year: i32, month: u32, day: u32, hour: u32, min: u32, sec: u32, nano: u32, ) -> Option<Self>
pub fn from_ymd_hms( year: i32, month: u32, day: u32, hour: u32, min: u32, sec: u32, ) -> Result<Self, Box<TypeError>>
pub fn from_bits(bits: u64) -> Self
pub fn to_bits(&self) -> u64
pub fn to_order(&self) -> u64
pub fn from_nanos(nanos: u64) -> Self
pub fn to_nanos(&self) -> u64
pub fn from_epoch_secs(secs: i64) -> Result<Self, Box<TypeError>>
pub fn from_epoch_millis(millis: u64) -> Result<Self, Box<TypeError>>
pub fn from_epoch_nanos(nanos: u128) -> Result<Self, Box<TypeError>>
pub fn to_epoch_secs(&self) -> i64
pub fn to_epoch_millis(&self) -> i64
pub fn to_epoch_nanos(&self) -> Result<i64, Box<TypeError>>
pub fn try_date(&self) -> Result<Date, Box<TypeError>>
pub fn date(&self) -> Date
pub fn time(&self) -> Time
pub fn to_nanos_since_epoch_u128(&self) -> u128
pub fn year(&self) -> i32
pub fn month(&self) -> u32
pub fn day(&self) -> u32
pub fn hour(&self) -> u32
pub fn minute(&self) -> u32
pub fn second(&self) -> u32
pub fn nanosecond(&self) -> u32
pub fn add_duration(&self, dur: &Duration) -> Result<Self, Box<TypeError>>
Source§impl DateTime
impl DateTime
pub fn saturating_add(self, rhs: Duration) -> DateTime
pub fn saturating_sub(self, rhs: Duration) -> DateTime
pub fn checked_add(self, rhs: Duration) -> Option<DateTime>
pub fn checked_sub(self, rhs: Duration) -> Option<DateTime>
pub fn saturating_duration_since(self, earlier: DateTime) -> Duration
Source§impl DateTime
impl DateTime
pub const ALIGNMENT: usize = 8
pub const EPOCH: DateTime
pub const MAX: DateTime
pub fn is_epoch(&self) -> bool
pub fn from_millis(millis: u64) -> Self
pub fn to_millis(&self) -> u64
pub fn to_micros(&self) -> u64
pub fn to_secs(&self) -> u64
pub fn saturating_add_millis(self, millis: u64) -> DateTime
pub fn saturating_sub_millis(self, millis: u64) -> DateTime
pub fn floor_to_millis(self, millis: u64) -> DateTime
Trait Implementations§
impl Copy for DateTime
Source§impl<'de> Deserialize<'de> for DateTime
impl<'de> Deserialize<'de> for DateTime
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for DateTime
Source§impl From<DateTime> for IsoDateTime
impl From<DateTime> for IsoDateTime
Source§impl From<IsoDateTime> for DateTime
impl From<IsoDateTime> for DateTime
Source§fn from(value: IsoDateTime) -> Self
fn from(value: IsoDateTime) -> Self
Converts to this type from the input type.
impl IsDate for DateTime
impl IsTemporal for DateTime
impl IsTime for DateTime
Source§impl Ord for DateTime
impl Ord for DateTime
1.21.0 (const: unstable) · 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 PartialOrd for DateTime
impl PartialOrd for DateTime
impl StructuralPartialEq for DateTime
Source§impl TryFromValue for DateTime
impl TryFromValue for DateTime
fn try_from_value(value: &Value) -> Result<Self, FromValueError>
fn from_value(value: &Value) -> Option<Self>
Source§impl TryFromValueCoerce for DateTime
impl TryFromValueCoerce for DateTime
fn try_from_value_coerce(value: &Value) -> Result<Self, FromValueError>
fn from_value_coerce(value: &Value) -> Option<Self>
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