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.
Sourcepub const fn from_timestamp_millis(millis: i64) -> Self
pub const fn from_timestamp_millis(millis: i64) -> Self
Create a new date and time object from the given Unix timestamp in milliseconds.
Sourcepub const fn from_timestamp_micros(micros: i64) -> Self
pub const fn from_timestamp_micros(micros: i64) -> Self
Create a new date and time object from the given Unix timestamp in microseconds.
Sourcepub const fn from_timestamp_nanos(nanos: i128) -> Self
pub const fn from_timestamp_nanos(nanos: i128) -> Self
Create a new date and time object from the given Unix timestamp in nanoseconds.
Source§impl DateTime
Accessors
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 AddAssign<TimeInterval> for DateTime
impl AddAssign<TimeInterval> for DateTime
Source§fn add_assign(&mut self, rhs: TimeInterval)
fn add_assign(&mut self, rhs: TimeInterval)
+=
operation. Read moreSource§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>
Source§impl FromStr for DateTime
impl FromStr for DateTime
Source§type Err = ParseError
type Err = ParseError
Source§impl Ord for DateTime
impl Ord for DateTime
Source§impl PartialOrd for DateTime
impl PartialOrd for DateTime
Source§impl Sub<TimeInterval> for DateTime
impl Sub<TimeInterval> for DateTime
Source§impl SubAssign<TimeInterval> for DateTime
impl SubAssign<TimeInterval> for DateTime
Source§fn sub_assign(&mut self, rhs: TimeInterval)
fn sub_assign(&mut self, rhs: TimeInterval)
-=
operation. Read more