pub enum DateFormat {
Ymd {
sep: char,
},
Mdy {
sep: char,
year_len: usize,
},
Dmy {
sep: char,
year_len: usize,
},
DMmmY {
sep: char,
year_len: usize,
month_case: StringCase,
month_full: bool,
},
MmmDY {
sep: char,
year_len: usize,
month_case: StringCase,
month_full: bool,
},
YMmmD {
sep: char,
year_len: usize,
month_case: StringCase,
month_full: bool,
},
Md {
sep: char,
},
My {
sep: char,
year_len: usize,
},
DMmm {
sep: char,
month_case: StringCase,
month_full: bool,
},
MmmD {
sep: char,
month_case: StringCase,
month_full: bool,
},
MmmY {
sep: char,
year_len: usize,
month_case: StringCase,
month_full: bool,
},
YMmm {
sep: char,
year_len: usize,
month_case: StringCase,
month_full: bool,
},
}Expand description
The notation a date was written in: field order, separator, year width and month-name spelling.
This is detection output, not the storage form. A cell stores an Excel
serial plus the format code this lowers to (CellStyle::num_format), which
is why a DateFormat can express a little more than survives a save –
month-name casing has no format-code equivalent, and zero-padding of a
numeric month or day is not recorded at all, so 06/22/2026 and
6/22/2026 are the same variant and both render unpadded.
The two-part variants fill in the missing field: a month/day pair takes
parse_date’s default year, a month/year pair takes day 1.
Variants§
Ymd
Year-month-day, all numeric: 2026-06-22.
Mdy
Month-day-year, all numeric: 06/22/2026, 6/22/26.
Fields
Dmy
Day-month-year, all numeric: 22-06-2026.
Fields
DMmmY
Day, month name, year: 22-Jun-2026, 22-June-26.
Fields
month_case: StringCaseCasing the month name was typed in.
MmmDY
Month name, day, year: Jun-22-2026, June-22-26.
Fields
month_case: StringCaseCasing the month name was typed in.
YMmmD
Year, month name, day: 2026-Jun-22.
Fields
month_case: StringCaseCasing the month name was typed in.
Md
Numeric month and day, year assumed: 6/22.
My
Numeric month and year, day assumed to be the 1st: 6/2026.
Fields
DMmm
Day then month name, year assumed: 22-Jun.
Fields
month_case: StringCaseCasing the month name was typed in.
MmmD
Month name then day, year assumed: Jun-22.
Fields
month_case: StringCaseCasing the month name was typed in.
MmmY
Month name then year, day assumed to be the 1st: Jun-2026.
Fields
month_case: StringCaseCasing the month name was typed in.
YMmm
Year then month name, day assumed to be the 1st: 2026-Jun.
Implementations§
Source§impl DateFormat
impl DateFormat
Sourcepub fn to_format_code(&self) -> String
pub fn to_format_code(&self) -> String
Lowers to an Excel number-format code (m/d/yy, d-mmm-yyyy, …).
This is the interchange form: it is what gets written to the worksheet
as a numFmt and what render_date_code consumes. Month-name casing
has no representation in a format code, so it rides alongside as
DateFormat::month_case.
Sourcepub fn month_case(&self) -> StringCase
pub fn month_case(&self) -> StringCase
The casing the month name was typed in, for the formats that have one.
Trait Implementations§
Source§impl Clone for DateFormat
impl Clone for DateFormat
Source§fn clone(&self) -> DateFormat
fn clone(&self) -> DateFormat
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DateFormat
Source§impl Debug for DateFormat
impl Debug for DateFormat
Source§impl<'de> Deserialize<'de> for DateFormat
impl<'de> Deserialize<'de> for DateFormat
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for DateFormat
Source§impl PartialEq for DateFormat
impl PartialEq for DateFormat
Source§impl Serialize for DateFormat
impl Serialize for DateFormat
impl StructuralPartialEq for DateFormat
Auto Trait Implementations§
impl Freeze for DateFormat
impl RefUnwindSafe for DateFormat
impl Send for DateFormat
impl Sync for DateFormat
impl Unpin for DateFormat
impl UnsafeUnpin for DateFormat
impl UnwindSafe for DateFormat
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.