pub struct DateTime {
pub year: i32,
pub month: u8,
pub day: u8,
pub hour: u8,
pub minute: u8,
pub second: u8,
}Expand description
A local date and time.
Fields§
§year: i32The year, such as 2026.
month: u8The month, from 1 to 12.
day: u8The day of the month, from 1.
hour: u8The hour, from 0 to 23.
minute: u8The minute, from 0 to 59.
second: u8The second, from 0 to 59.
Implementations§
Source§impl DateTime
impl DateTime
Sourcepub fn local_date(self, zone_minutes: i32) -> DateTime
pub fn local_date(self, zone_minutes: i32) -> DateTime
The date of this time, taken as UTC, in a time zone zone_minutes east of UTC (west when
it is negative), at midnight: the day before or after when the zone moves the time past
midnight, by as many days as it moves it.
Sourcepub fn parse_utc(text: &str) -> Option<DateTime>
pub fn parse_utc(text: &str) -> Option<DateTime>
Reads a time in UTC written as ISO 8601, such as 2018-12-28T13:00:00Z, the form of
vt:filetime values.
Sourcepub fn parse_text(text: &str) -> Option<DateTime>
pub fn parse_text(text: &str) -> Option<DateTime>
Reads a date written as text: “20 April 2023” or “20 Apr 2023”, “April 20, 2023”, or “2023-04-20”. The time is midnight.
Sourcepub fn write(self, picture: &str) -> String
pub fn write(self, picture: &str) -> String
Writes the date and time with a date and time picture: d, dd, ddd and dddd for
the day and its name, M to MMMM for the month, yy and yyyy for the year, h,
hh, H and HH for the hour, m and mm for the minute, s and ss for the
second, and AM/PM or am/pm. Text in single quotes and other characters stay as they
are.
Trait Implementations§
impl Copy for DateTime
impl Eq for DateTime
impl StructuralPartialEq for DateTime
Auto Trait Implementations§
impl Forget for DateTime
impl Freeze for DateTime
impl Move for DateTime
impl RefUnwindSafe for DateTime
impl Send for DateTime
impl Sync for DateTime
impl Unpin for DateTime
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.