pub struct DateTime { /* private fields */ }
Expand description
A representation of a date and time.
Implementations§
source§impl DateTime
impl DateTime
sourcepub const fn ymd(year: i16, month: u8, day: u8) -> DateTimeBuilder
pub const fn ymd(year: i16, month: u8, day: u8) -> DateTimeBuilder
Create a new date and time object.
sourcepub const fn from_timestamp(timestamp: i64, nanos: u32) -> Self
pub const fn from_timestamp(timestamp: i64, nanos: u32) -> Self
Create a new date and time object from the given Unix timestamp.
source§impl DateTime
impl DateTime
Accessors
sourcepub const fn second(&self) -> u8
pub const fn second(&self) -> u8
The second of the minute for this date and time. Range: [0, 60)
sourcepub const fn nanosecond(&self) -> u32
pub const fn nanosecond(&self) -> u32
The nanosecond of the second for this date and time. Range: [0, 1_000_000_000)
sourcepub const fn day_of_year(&self) -> u16
pub const fn day_of_year(&self) -> u16
The ordinal day of the year.
sourcepub const fn as_seconds(&self) -> i64
pub const fn as_seconds(&self) -> i64
The number of seconds since the Unix epoch for this date and time.
sourcepub const fn as_milliseconds(&self) -> i64
pub const fn as_milliseconds(&self) -> i64
The number of milliseconds since the Unix epoch for this date and time.
sourcepub const fn as_microseconds(&self) -> i64
pub const fn as_microseconds(&self) -> i64
The number of microseconds since the Unix epoch for this date and time.
sourcepub const fn as_nanoseconds(&self) -> i128
pub const fn as_nanoseconds(&self) -> i128
The number of nanoseconds since the Unix epoch for this date and time.
Trait Implementations§
source§impl Add<TimeInterval> for DateTime
impl Add<TimeInterval> for DateTime
source§impl<'de> Deserialize<'de> for DateTime
impl<'de> Deserialize<'de> for DateTime
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
source§impl FromStr for DateTime
impl FromStr for DateTime
§type Err = ParseError
type Err = ParseError
The associated error which can be returned from parsing.
source§impl Ord for DateTime
impl Ord for DateTime
source§impl PartialEq for DateTime
impl PartialEq for DateTime
source§impl PartialOrd for DateTime
impl PartialOrd 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 moresource§impl Sub<TimeInterval> for DateTime
impl Sub<TimeInterval> for DateTime
source§impl TryFrom<RawDateTime> for DateTime
impl TryFrom<RawDateTime> for DateTime
§type Error = ParseError
type Error = ParseError
The type returned in the event of a conversion error.
source§fn try_from(value: RawDateTime) -> ParseResult<Self>
fn try_from(value: RawDateTime) -> ParseResult<Self>
Performs the conversion.
impl Copy for DateTime
impl Eq for DateTime
Auto Trait Implementations§
impl Freeze for DateTime
impl RefUnwindSafe for DateTime
impl Send for DateTime
impl Sync for DateTime
impl Unpin for DateTime
impl UnwindSafe for DateTime
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