pub struct TimeStamp {
pub year: u16,
pub month: Option<u8>,
pub day: Option<u8>,
pub hour: Option<u8>,
pub minute: Option<u8>,
pub second: Option<u8>,
pub microsecond: Option<u32>,
pub offset: Option<TimeStampOffset>,
}
Expand description
The results of parsing a timestamp. Note that the timestamp is not validated, i.e. it may not be a valid date or time.
Fields§
§year: u16
The year of the timestamp
month: Option<u8>
The month of the timestamp (1-12)
day: Option<u8>
The day of the timestamp (1-31)
hour: Option<u8>
The hour of the timestamp (0-23)
minute: Option<u8>
The minute of the timestamp (0-59)
second: Option<u8>
The second of the timestamp (0-59)
microsecond: Option<u32>
The microsecond of the timestamp (0-999_900)
offset: Option<TimeStampOffset>
The timezone offset of the timestamp
Trait Implementations§
Source§impl DateTime for TimeStamp
impl DateTime for TimeStamp
Source§fn parse(
s: &str,
lenient_trailing_chars: bool,
) -> Result<Self, DateTimeParseError>
fn parse( s: &str, lenient_trailing_chars: bool, ) -> Result<Self, DateTimeParseError>
Date
, Time
, or TimeStamp
structSource§fn parse_strict(s: &str) -> Result<Self, DateTimeParseError>where
Self: Sized,
fn parse_strict(s: &str) -> Result<Self, DateTimeParseError>where
Self: Sized,
Date
, Time
, or TimeStamp
struct, with
strict parsing dissallowing trailing charactersSource§impl<'de> Deserialize<'de> for TimeStamp
impl<'de> Deserialize<'de> for TimeStamp
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>,
Source§impl Display for TimeStamp
Implement Display
for TimeStamp
to allow formatting timestamps as HL7 strings
impl Display for TimeStamp
Implement Display
for TimeStamp
to allow formatting timestamps as HL7 strings
Source§impl<Tz> From<DateTime<Tz>> for TimeStamp
Convert a DateTime
into a TimeStamp
. The TimeStamp
will have the date
and time components set to the DateTime
’s components and the offset
components set to the DateTime
’s offset components.
impl<Tz> From<DateTime<Tz>> for TimeStamp
Convert a DateTime
into a TimeStamp
. The TimeStamp
will have the date
and time components set to the DateTime
’s components and the offset
components set to the DateTime
’s offset components.
Source§impl From<NaiveDate> for TimeStamp
Convert a NaiveDate
into a TimeStamp
. The TimeStamp
will have the
date components set to the NaiveDate
’s components and the time components
set to None
.
impl From<NaiveDate> for TimeStamp
Convert a NaiveDate
into a TimeStamp
. The TimeStamp
will have the
date components set to the NaiveDate
’s components and the time components
set to None
.
Source§impl From<NaiveDateTime> for TimeStamp
Convert a NaiveDateTime
into a TimeStamp
. The TimeStamp
will have the
date and time components set to the NaiveDateTime
’s components and the
offset components set to None
.
impl From<NaiveDateTime> for TimeStamp
Convert a NaiveDateTime
into a TimeStamp
. The TimeStamp
will have the
date and time components set to the NaiveDateTime
’s components and the
offset components set to None
.
Source§fn from(value: NaiveDateTime) -> Self
fn from(value: NaiveDateTime) -> Self
Source§impl From<OffsetDateTime> for TimeStamp
impl From<OffsetDateTime> for TimeStamp
Source§fn from(value: OffsetDateTime) -> Self
fn from(value: OffsetDateTime) -> Self
Source§impl From<PrimitiveDateTime> for TimeStamp
impl From<PrimitiveDateTime> for TimeStamp
Source§fn from(value: PrimitiveDateTime) -> Self
fn from(value: PrimitiveDateTime) -> Self
Source§impl FromStr for TimeStamp
Implement FromStr
for TimeStamp
to allow parsing timestamps from strings
impl FromStr for TimeStamp
Implement FromStr
for TimeStamp
to allow parsing timestamps from strings
Source§impl TryFrom<TimeStamp> for Date
impl TryFrom<TimeStamp> for Date
Source§type Error = DateTimeParseError
type Error = DateTimeParseError
Source§impl TryFrom<TimeStamp> for DateTime
impl TryFrom<TimeStamp> for DateTime
Source§type Error = DateTimeParseError
type Error = DateTimeParseError
Source§impl<Tz> TryFrom<TimeStamp> for DateTime<Tz>
Attempt to convert a TimeStamp
into a DateTime<Tz>
. If the TimeStamp
is
missing date components, those components will be set to 1
. If the
TimeStamp
is missing time components, those components will be set to zero.
If the TimeStamp
is missing offset components, those components will be set
to zero.
impl<Tz> TryFrom<TimeStamp> for DateTime<Tz>
Attempt to convert a TimeStamp
into a DateTime<Tz>
. If the TimeStamp
is
missing date components, those components will be set to 1
. If the
TimeStamp
is missing time components, those components will be set to zero.
If the TimeStamp
is missing offset components, those components will be set
to zero.
Note that this implementation will return an error if the TimeStamp
is
ambiguous or does not exist.
Source§impl TryFrom<TimeStamp> for LocalResult<DateTime<FixedOffset>>
Attempt to convert a TimeStamp
into a DateTime<FixedOffset>
. If the
TimeStamp
is missing date components, those components will be set to 1
.
If the TimeStamp
is missing time components, those components will be set
to zero. If the TimeStamp
is missing offset components, those components
will be set to zero.
impl TryFrom<TimeStamp> for LocalResult<DateTime<FixedOffset>>
Attempt to convert a TimeStamp
into a DateTime<FixedOffset>
. If the
TimeStamp
is missing date components, those components will be set to 1
.
If the TimeStamp
is missing time components, those components will be set
to zero. If the TimeStamp
is missing offset components, those components
will be set to zero.
Source§impl TryFrom<TimeStamp> for NaiveDate
Attempt to convert a TimeStamp
into a NaiveDate
. If the TimeStamp
is
missing date components, those components will be set to 1
.
impl TryFrom<TimeStamp> for NaiveDate
Attempt to convert a TimeStamp
into a NaiveDate
. If the TimeStamp
is
missing date components, those components will be set to 1
.
Source§impl TryFrom<TimeStamp> for NaiveDateTime
Attempt to convert a TimeStamp
into a NaiveDateTime
. If the TimeStamp
is missing time components, those components will be set to zero.
impl TryFrom<TimeStamp> for NaiveDateTime
Attempt to convert a TimeStamp
into a NaiveDateTime
. If the TimeStamp
is missing time components, those components will be set to zero.