Skip to main content

DateTimeFormatInfo

Struct DateTimeFormatInfo 

Source
pub struct DateTimeFormatInfo { /* private fields */ }
Expand description

The date and time conventions of a culture.

The instances handed out by CultureInfo::date_time_format are shared and read-only; to change conventions clone the value, use the setters and attach it to a culture with CultureInfo::with_date_time_format.

Implementations§

Source§

impl DateTimeFormatInfo

Source

pub fn new() -> DateTimeFormatInfo

Conventions with the values of the invariant culture (C# new DateTimeFormatInfo()); change them with the setters.

Source

pub fn invariant_info() -> Rc<DateTimeFormatInfo>

The conventions of the invariant culture.

Source

pub fn current_info() -> Rc<DateTimeFormatInfo>

The conventions of the current culture.

Source

pub fn calendar(&self) -> GregorianCalendar

The calendar of the conventions; always the Gregorian one.

Source

pub fn short_date_pattern(&self) -> &str

The pattern of a short date (format "d").

Source

pub fn set_short_date_pattern(&mut self, value: impl Into<String>)

Sets the pattern of a short date.

Source

pub fn long_date_pattern(&self) -> &str

The pattern of a long date (format "D").

Source

pub fn set_long_date_pattern(&mut self, value: impl Into<String>)

Sets the pattern of a long date.

Source

pub fn short_time_pattern(&self) -> &str

The pattern of a short time (format "t").

Source

pub fn set_short_time_pattern(&mut self, value: impl Into<String>)

Sets the pattern of a short time.

Source

pub fn long_time_pattern(&self) -> &str

The pattern of a long time (format "T").

Source

pub fn set_long_time_pattern(&mut self, value: impl Into<String>)

Sets the pattern of a long time.

Source

pub fn full_date_time_pattern(&self) -> Cow<'_, str>

The pattern of a long date and long time (format "F"): the long date pattern, a space and the long time pattern unless set explicitly.

Source

pub fn set_full_date_time_pattern(&mut self, value: impl Into<String>)

Sets the pattern of a long date and long time.

Source

pub fn month_day_pattern(&self) -> &str

The pattern of a month and day (format "M").

Source

pub fn set_month_day_pattern(&mut self, value: impl Into<String>)

Sets the pattern of a month and day.

Source

pub fn year_month_pattern(&self) -> &str

The pattern of a year and month (format "Y").

Source

pub fn set_year_month_pattern(&mut self, value: impl Into<String>)

Sets the pattern of a year and month.

Source

pub fn rfc1123_pattern(&self) -> &'static str

The pattern of the round-trip format "R" (RFC 1123).

Source

pub fn sortable_date_time_pattern(&self) -> &'static str

The pattern of the sortable format "s".

Source

pub fn universal_sortable_date_time_pattern(&self) -> &'static str

The pattern of the universal sortable format "u".

Source

pub fn am_designator(&self) -> &str

The designator of hours before noon.

Source

pub fn set_am_designator(&mut self, value: impl Into<String>)

Sets the designator of hours before noon.

Source

pub fn pm_designator(&self) -> &str

The designator of hours after noon.

Source

pub fn set_pm_designator(&mut self, value: impl Into<String>)

Sets the designator of hours after noon.

Source

pub fn date_separator(&self) -> &str

The text the / specifier of a custom format produces.

Source

pub fn set_date_separator(&mut self, value: impl Into<String>)

Sets the date separator.

Source

pub fn time_separator(&self) -> &str

The text the : specifier of a custom format produces.

Source

pub fn set_time_separator(&mut self, value: impl Into<String>)

Sets the time separator.

Source

pub fn first_day_of_week(&self) -> DayOfWeek

The first day of the week.

Source

pub fn set_first_day_of_week(&mut self, value: DayOfWeek)

Sets the first day of the week.

Source

pub fn calendar_week_rule(&self) -> CalendarWeekRule

The rule that determines the first week of a year.

Source

pub fn set_calendar_week_rule(&mut self, value: CalendarWeekRule)

Sets the rule that determines the first week of a year.

Source

pub fn day_names(&self) -> &[String; 7]

The full names of the days, indexed by DayOfWeek (Sunday first).

Source

pub fn set_day_names(&mut self, value: [String; 7])

Sets the full names of the days.

Source

pub fn abbreviated_day_names(&self) -> &[String; 7]

The abbreviated names of the days, indexed by DayOfWeek.

Source

pub fn set_abbreviated_day_names(&mut self, value: [String; 7])

Sets the abbreviated names of the days.

Source

pub fn shortest_day_names(&self) -> &[String; 7]

The shortest unique names of the days, indexed by DayOfWeek.

Source

pub fn set_shortest_day_names(&mut self, value: [String; 7])

Sets the shortest names of the days.

Source

pub fn month_names(&self) -> &[String; 13]

The full names of the months; the thirteenth entry is empty, as in .NET.

Source

pub fn set_month_names(&mut self, value: [String; 13])

Sets the full names of the months.

Source

pub fn abbreviated_month_names(&self) -> &[String; 13]

The abbreviated names of the months; the thirteenth entry is empty.

Source

pub fn set_abbreviated_month_names(&mut self, value: [String; 13])

Sets the abbreviated names of the months.

Source

pub fn get_day_name(&self, day_of_week: DayOfWeek) -> &str

The full name of a day.

Source

pub fn get_abbreviated_day_name(&self, day_of_week: DayOfWeek) -> &str

The abbreviated name of a day.

Source

pub fn get_shortest_day_name(&self, day_of_week: DayOfWeek) -> &str

The shortest name of a day.

Source

pub fn get_month_name(&self, month: i32) -> &str

The full name of a month, 1..=13. Panics for other values.

Source

pub fn get_abbreviated_month_name(&self, month: i32) -> &str

The abbreviated name of a month, 1..=13. Panics for other values.

Source

pub fn get_era_name(&self, _era: i32) -> &str

The name of the only era of the Gregorian calendar (the g specifier).

Source

pub fn set_era_name(&mut self, value: impl Into<String>)

Sets the name of the era.

Trait Implementations§

Source§

impl Clone for DateTimeFormatInfo

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl DateTimeFormatProvider for DateTimeFormatInfo

Source§

fn get_date_time_format(&self) -> DateTimeFormatInfoRef<'_>

The conventions to format and parse with.
Source§

impl Debug for DateTimeFormatInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DateTimeFormatInfo

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for DateTimeFormatInfo

Source§

impl PartialEq for DateTimeFormatInfo

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DateTimeFormatInfo

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyValue for T
where T: PartialEq + 'static,

Source§

fn any_value_as_any(&self) -> &(dyn Any + 'static)

Source§

fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool

Source§

fn any_value_type_name(&self) -> &'static str

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PropertyValue for T
where T: Clone + PartialEq + 'static,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.