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§
source§impl 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§
source§impl DecodeValue<'_> for DateTime
impl DecodeValue<'_> for DateTime
source§impl EncodeValue for DateTime
impl EncodeValue for DateTime
source§impl From<&DateTime> for GeneralizedTime
impl From<&DateTime> for GeneralizedTime
source§impl From<&GeneralizedTime> for DateTime
impl From<&GeneralizedTime> for DateTime
source§fn from(utc_time: &GeneralizedTime) -> DateTime
fn from(utc_time: &GeneralizedTime) -> DateTime
Converts to this type from the input type.
source§impl From<DateTime> for GeneralizedTime
impl From<DateTime> for GeneralizedTime
source§impl From<GeneralizedTime> for DateTime
impl From<GeneralizedTime> for DateTime
source§fn from(utc_time: GeneralizedTime) -> DateTime
fn from(utc_time: GeneralizedTime) -> DateTime
Converts to this type from the input type.
source§impl Ord for DateTime
impl Ord for DateTime
source§impl PartialOrd<DateTime> for DateTime
impl PartialOrd<DateTime> for DateTime
1.0.0 · source§fn 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