Struct bson::UtcDateTime
[−]
[src]
pub struct UtcDateTime(pub DateTime<UTC>);
DateTime
representation in struct for serde serialization
Just a helper for convenience
#[macro_use] extern crate serde_derive; extern crate bson; use bson::UtcDateTime; #[derive(Serialize, Deserialize)] struct Foo { date_time: UtcDateTime, }
Methods from Deref<Target = DateTime<UTC>>
fn date(&self) -> Date<Tz>
Retrieves a date component.
fn time(&self) -> NaiveTime
Retrieves a time component.
Unlike date
, this is not associated to the time zone.
fn timestamp(&self) -> i64
Returns the number of non-leap seconds since January 1, 1970 0:00:00 UTC (aka "UNIX timestamp").
fn timestamp_subsec_millis(&self) -> u32
Returns the number of milliseconds since the last second boundary
warning: in event of a leap second, this may exceed 999
note: this is not the number of milliseconds since January 1, 1970 0:00:00 UTC
fn timestamp_subsec_micros(&self) -> u32
Returns the number of microseconds since the last second boundary
warning: in event of a leap second, this may exceed 999_999
note: this is not the number of microseconds since January 1, 1970 0:00:00 UTC
fn timestamp_subsec_nanos(&self) -> u32
Returns the number of nanoseconds since the last second boundary
warning: in event of a leap second, this may exceed 999_999_999
note: this is not the number of nanoseconds since January 1, 1970 0:00:00 UTC
fn offset(&'a self) -> &'a <Tz as TimeZone>::Offset
Retrieves an associated offset from UTC.
fn timezone(&self) -> Tz
Retrieves an associated time zone.
fn with_timezone<Tz2>(&self, tz: &Tz2) -> DateTime<Tz2> where
Tz2: TimeZone,
Tz2: TimeZone,
Changes the associated time zone.
This does not change the actual DateTime
(but will change the string representation).
fn checked_add_signed(self, rhs: Duration) -> Option<DateTime<Tz>>
Adds given Duration
to the current date and time.
Returns None
when it will result in overflow.
fn checked_sub_signed(self, rhs: Duration) -> Option<DateTime<Tz>>
Subtracts given Duration
from the current date and time.
Returns None
when it will result in overflow.
fn signed_duration_since<Tz2>(self, rhs: DateTime<Tz2>) -> Duration where
Tz2: TimeZone,
Tz2: TimeZone,
Subtracts another DateTime
from the current date and time.
This does not overflow or underflow at all.
fn naive_utc(&self) -> NaiveDateTime
Returns a view to the naive UTC datetime.
fn naive_local(&self) -> NaiveDateTime
Returns a view to the naive local datetime.
fn to_rfc2822(&self) -> String
Returns an RFC 2822 date and time string such as Tue, 1 Jul 2003 10:52:37 +0200
.
fn to_rfc3339(&self) -> String
Returns an RFC 3339 and ISO 8601 date and time string such as 1996-12-19T16:39:57-08:00
.
fn format_with_items<'a, I>(&self, items: I) -> DelayedFormat<I> where
I: Iterator<Item = Item<'a>> + Clone,
I: Iterator<Item = Item<'a>> + Clone,
Formats the combined date and time with the specified formatting items.
fn format(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>>
Formats the combined date and time with the specified format string.
See the format::strftime
module
on the supported escape sequences.
Trait Implementations
impl Debug for UtcDateTime
[src]
impl Eq for UtcDateTime
[src]
impl PartialEq for UtcDateTime
[src]
fn eq(&self, __arg_0: &UtcDateTime) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &UtcDateTime) -> bool
This method tests for !=
.
impl Copy for UtcDateTime
[src]
impl Clone for UtcDateTime
[src]
fn clone(&self) -> UtcDateTime
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Deref for UtcDateTime
[src]
type Target = DateTime<UTC>
The resulting type after dereferencing
fn deref(&self) -> &Self::Target
The method called to dereference a value
impl DerefMut for UtcDateTime
[src]
impl Into<DateTime<UTC>> for UtcDateTime
[src]
impl From<DateTime<UTC>> for UtcDateTime
[src]
impl Serialize for UtcDateTime
[src]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<'de> Deserialize<'de> for UtcDateTime
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more