pub struct UtcDateTime(/* private fields */);Expand description
Date and time with binary encoding support.
Implementations§
Source§impl UtcDateTime
impl UtcDateTime
Sourcepub fn to_timezone<T: TimeZone>(&self, tz: &T) -> Self
pub fn to_timezone<T: TimeZone>(&self, tz: &T) -> Self
Convert this date time to the given timezone.
Sourcepub fn from_calendar_date(
year: i32,
month: Month,
day: u8,
) -> Result<Self, Error>
pub fn from_calendar_date( year: i32, month: Month, day: u8, ) -> Result<Self, Error>
Create from a calendar date.
Sourcepub fn parse_simple_date(s: &str) -> Result<Self, Error>
pub fn parse_simple_date(s: &str) -> Result<Self, Error>
Parse from a simple date format YYYY-MM-DD.
Sourcepub fn format_simple_date(&self) -> Result<String, Error>
pub fn format_simple_date(&self) -> Result<String, Error>
Format as a simple date YYYY-MM-DD.
Sourcepub fn format(&self, description: &str) -> Result<String, Error>
pub fn format(&self, description: &str) -> Result<String, Error>
Format according to a format description.
Sourcepub fn parse_rfc3339(value: &str) -> Result<Self, Error>
pub fn parse_rfc3339(value: &str) -> Result<Self, Error>
Parse as RFC3339.
Sourcepub fn to_date_time(&self) -> Result<String, Error>
pub fn to_date_time(&self) -> Result<String, Error>
Convert to a short human-readable date and time without the timezone offset.
Sourcepub fn to_rfc2822(&self) -> Result<String, Error>
pub fn to_rfc2822(&self) -> Result<String, Error>
Convert this timestamp to a RFC2822 formatted string.
Sourcepub fn to_rfc3339(&self) -> Result<String, Error>
pub fn to_rfc3339(&self) -> Result<String, Error>
Convert this date and time to a RFC3339 formatted string.
Trait Implementations§
Source§impl Clone for UtcDateTime
impl Clone for UtcDateTime
Source§fn clone(&self) -> UtcDateTime
fn clone(&self) -> UtcDateTime
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UtcDateTime
impl Debug for UtcDateTime
Source§impl Decodable for UtcDateTime
impl Decodable for UtcDateTime
Source§impl Default for UtcDateTime
impl Default for UtcDateTime
Source§impl<'de> Deserialize<'de> for UtcDateTime
impl<'de> Deserialize<'de> for UtcDateTime
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
Source§impl Display for UtcDateTime
impl Display for UtcDateTime
Source§impl Encodable for UtcDateTime
impl Encodable for UtcDateTime
Source§fn encode<'life0, 'life1, 'async_trait, W>(
&'life0 self,
writer: &'life1 mut BinaryWriter<W>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
W: 'async_trait + AsyncWrite + AsyncSeek + Unpin + Send,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn encode<'life0, 'life1, 'async_trait, W>(
&'life0 self,
writer: &'life1 mut BinaryWriter<W>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
W: 'async_trait + AsyncWrite + AsyncSeek + Unpin + Send,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Encode self into the binary writer.
Source§impl From<OffsetDateTime> for UtcDateTime
impl From<OffsetDateTime> for UtcDateTime
Source§fn from(value: OffsetDateTime) -> Self
fn from(value: OffsetDateTime) -> Self
Converts to this type from the input type.
Source§impl From<UtcDateTime> for OffsetDateTime
impl From<UtcDateTime> for OffsetDateTime
Source§fn from(value: UtcDateTime) -> Self
fn from(value: UtcDateTime) -> Self
Converts to this type from the input type.
Source§impl Ord for UtcDateTime
impl Ord for UtcDateTime
Source§fn cmp(&self, other: &UtcDateTime) -> Ordering
fn cmp(&self, other: &UtcDateTime) -> Ordering
1.21.0 · 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 PartialEq for UtcDateTime
impl PartialEq for UtcDateTime
Source§impl PartialOrd for UtcDateTime
impl PartialOrd for UtcDateTime
Source§impl Serialize for UtcDateTime
impl Serialize for UtcDateTime
impl Eq for UtcDateTime
impl StructuralPartialEq for UtcDateTime
Auto Trait Implementations§
impl Freeze for UtcDateTime
impl RefUnwindSafe for UtcDateTime
impl Send for UtcDateTime
impl Sync for UtcDateTime
impl Unpin for UtcDateTime
impl UnwindSafe for UtcDateTime
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