pub struct DateTime { /* private fields */ }
Expand description
Date-and-time type shared by multiple ASN.1 types
(e.g. GeneralizedTime
, UTCTime
).
Following conventions from RFC 5280, this type is always Z-normalized
(i.e. represents a UTC time). However, it isn’t named “UTC time” in order
to prevent confusion with ASN.1 UTCTime
.
Implementations
sourceimpl DateTime
impl DateTime
sourcepub fn new(
year: u16,
month: u8,
day: u8,
hour: u8,
minutes: u8,
seconds: u8
) -> Result<Self>
pub fn new(
year: u16,
month: u8,
day: u8,
hour: u8,
minutes: u8,
seconds: u8
) -> Result<Self>
Create a new DateTime
from the given UTC time components.
sourcepub fn from_unix_duration(unix_duration: Duration) -> Result<Self>
pub fn from_unix_duration(unix_duration: Duration) -> Result<Self>
sourcepub fn unix_duration(&self) -> Duration
pub fn unix_duration(&self) -> Duration
Compute Duration
since UNIX_EPOCH
from the given calendar date.
Trait Implementations
sourceimpl DecodeValue<'_> for DateTime
impl DecodeValue<'_> for DateTime
sourceimpl EncodeValue for DateTime
impl EncodeValue for DateTime
sourceimpl From<&DateTime> for GeneralizedTime
impl From<&DateTime> for GeneralizedTime
sourceimpl From<&GeneralizedTime> for DateTime
impl From<&GeneralizedTime> for DateTime
sourcefn from(utc_time: &GeneralizedTime) -> DateTime
fn from(utc_time: &GeneralizedTime) -> DateTime
Converts to this type from the input type.
sourceimpl From<DateTime> for GeneralizedTime
impl From<DateTime> for GeneralizedTime
sourceimpl From<GeneralizedTime> for DateTime
impl From<GeneralizedTime> for DateTime
sourcefn from(utc_time: GeneralizedTime) -> DateTime
fn from(utc_time: GeneralizedTime) -> DateTime
Converts to this type from the input type.
sourceimpl Ord for DateTime
impl Ord for DateTime
sourceimpl PartialOrd<DateTime> for DateTime
impl PartialOrd<DateTime> for DateTime
sourcefn partial_cmp(&self, other: &DateTime) -> Option<Ordering>
fn partial_cmp(&self, other: &DateTime) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for DateTime
impl Eq for DateTime
impl OrdIsValueOrd for DateTime
impl StructuralEq for DateTime
impl StructuralPartialEq for DateTime
Auto Trait Implementations
impl RefUnwindSafe for DateTime
impl Send for DateTime
impl Sync for DateTime
impl Unpin for DateTime
impl UnwindSafe for DateTime
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more