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.
sourcepub fn from_system_time(time: SystemTime) -> Result<Self>
Available on crate feature std
only.
pub fn from_system_time(time: SystemTime) -> Result<Self>
std
only.Instantiate from SystemTime
.
sourcepub fn to_system_time(&self) -> SystemTime
Available on crate feature std
only.
pub fn to_system_time(&self) -> SystemTime
std
only.Convert to SystemTime
.
Trait Implementations
sourceimpl<'a> DecodeValue<'a> for DateTime
impl<'a> DecodeValue<'a> for DateTime
sourceimpl EncodeValue for DateTime
impl EncodeValue for DateTime
sourceimpl From<&'_ DateTime> for GeneralizedTime
impl From<&'_ DateTime> for GeneralizedTime
sourceimpl From<&'_ DateTime> for SystemTime
Available on crate feature std
only.
impl From<&'_ DateTime> for SystemTime
std
only.sourcefn from(time: &DateTime) -> SystemTime
fn from(time: &DateTime) -> SystemTime
Converts to this type from the input type.
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<DateTime> for SystemTime
Available on crate feature std
only.
impl From<DateTime> for SystemTime
std
only.sourcefn from(time: DateTime) -> SystemTime
fn from(time: DateTime) -> SystemTime
Converts to this type from the input type.
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
sourceimpl TryFrom<&'_ SystemTime> for DateTime
Available on crate feature std
only.
impl TryFrom<&'_ SystemTime> for DateTime
std
only.sourceimpl TryFrom<DateTime> for PrimitiveDateTime
Available on crate feature time
only.
impl TryFrom<DateTime> for PrimitiveDateTime
time
only.sourceimpl TryFrom<PrimitiveDateTime> for DateTime
Available on crate feature time
only.
impl TryFrom<PrimitiveDateTime> for DateTime
time
only.sourceimpl TryFrom<SystemTime> for DateTime
Available on crate feature std
only.
impl TryFrom<SystemTime> for DateTime
std
only.impl Copy for DateTime
impl Eq 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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more