pub struct LocalDateTime { /* private fields */ }
Expand description
A local date-time is an exact instant on the timeline, without a time zone.
Implementations§
Source§impl LocalDateTime
impl LocalDateTime
Sourcepub fn from_instant(instant: Instant) -> Self
pub fn from_instant(instant: Instant) -> Self
Computes a complete date-time based on the values in the given Instant parameter.
Sourcepub fn at(seconds_since_1970_epoch: i64) -> Self
pub fn at(seconds_since_1970_epoch: i64) -> Self
Computes a complete date-time based on the number of seconds that have elapsed since midnight, 1st January, 1970, setting the number of milliseconds to 0.
Sourcepub fn at_ms(seconds_since_1970_epoch: i64, millisecond_of_second: i16) -> Self
pub fn at_ms(seconds_since_1970_epoch: i64, millisecond_of_second: i16) -> Self
Computes a complete date-time based on the number of seconds that have elapsed since midnight, 1st January, 1970,
Sourcepub fn new(date: LocalDate, time: LocalTime) -> Self
pub fn new(date: LocalDate, time: LocalTime) -> Self
Creates a new local date time from a local date and a local time.
pub fn to_instant(&self) -> Instant
pub fn add_seconds(&self, seconds: i64) -> Self
Trait Implementations§
Source§impl Add<Duration> for LocalDateTime
impl Add<Duration> for LocalDateTime
Source§impl Clone for LocalDateTime
impl Clone for LocalDateTime
Source§fn clone(&self) -> LocalDateTime
fn clone(&self) -> LocalDateTime
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 DatePiece for LocalDateTime
impl DatePiece for LocalDateTime
Source§fn year(&self) -> i64
fn year(&self) -> i64
The year, in absolute terms.
This is in human-readable format, so the year 2014 actually has a
year value of 2014, rather than 14 or 114 or anything like that.
Source§fn year_of_century(&self) -> i64
fn year_of_century(&self) -> i64
The number of years into the century.
This is the same as the last two digits of the year.
Source§fn years_from_2000(&self) -> i64
fn years_from_2000(&self) -> i64
The year number, relative to the year 2000.
Internally, many routines use years relative the year 2000,
rather than the year 0 (well, 1 BCE).
Source§impl Debug for LocalDateTime
impl Debug for LocalDateTime
Source§impl FromStr for LocalDateTime
impl FromStr for LocalDateTime
Source§impl ISO for LocalDateTime
impl ISO for LocalDateTime
Source§impl Ord for LocalDateTime
impl Ord for LocalDateTime
Source§fn cmp(&self, other: &LocalDateTime) -> Ordering
fn cmp(&self, other: &LocalDateTime) -> 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 LocalDateTime
impl PartialEq for LocalDateTime
Source§impl PartialOrd for LocalDateTime
impl PartialOrd for LocalDateTime
Source§impl Sub<Duration> for LocalDateTime
impl Sub<Duration> for LocalDateTime
Source§impl TimePiece for LocalDateTime
impl TimePiece for LocalDateTime
impl Copy for LocalDateTime
impl Eq for LocalDateTime
impl StructuralPartialEq for LocalDateTime
Auto Trait Implementations§
impl Freeze for LocalDateTime
impl RefUnwindSafe for LocalDateTime
impl Send for LocalDateTime
impl Sync for LocalDateTime
impl Unpin for LocalDateTime
impl UnwindSafe for LocalDateTime
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