pub struct DateTimeFormatter { /* private fields */ }Expand description
A locale-aware date and time formatter.
Implementations§
Source§impl DateTimeFormatter
impl DateTimeFormatter
Sourcepub fn for_locale(locale: &str) -> Result<DateTimeFormatter, FormattingError>
pub fn for_locale(locale: &str) -> Result<DateTimeFormatter, FormattingError>
Create a DateTimeFormatter for a locale tag.
§Errors
Returns FormattingError::UnsupportedLocale if the locale is not supported.
Sourcepub fn from_data(data: &'static LocaleData) -> DateTimeFormatter
pub fn from_data(data: &'static LocaleData) -> DateTimeFormatter
Create directly from pinned locale data.
Sourcepub fn format_date(&self, date: &Date, style: DateFormatStyle) -> String
pub fn format_date(&self, date: &Date, style: DateFormatStyle) -> String
Format a calendar date according to the locale’s conventions.
Sourcepub fn format_time(&self, time: &Time, style: TimeFormatStyle) -> String
pub fn format_time(&self, time: &Time, style: TimeFormatStyle) -> String
Format a wall-clock time according to the locale’s conventions.
Sourcepub fn format_datetime(
&self,
dt: &DateTime,
date_style: DateFormatStyle,
time_style: TimeFormatStyle,
) -> String
pub fn format_datetime( &self, dt: &DateTime, date_style: DateFormatStyle, time_style: TimeFormatStyle, ) -> String
Format a combined DateTime.
Trait Implementations§
Source§impl Clone for DateTimeFormatter
impl Clone for DateTimeFormatter
Source§fn clone(&self) -> DateTimeFormatter
fn clone(&self) -> DateTimeFormatter
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DateTimeFormatter
impl RefUnwindSafe for DateTimeFormatter
impl Send for DateTimeFormatter
impl Sync for DateTimeFormatter
impl Unpin for DateTimeFormatter
impl UnsafeUnpin for DateTimeFormatter
impl UnwindSafe for DateTimeFormatter
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