DMY Date (dash-separated)
datetime.date.dmy_dashDay-Month-Year with dash separators and 4-digit year. Extremely common in EU informal data and Pandas examples. Ambiguous with mdy_dash when day <= 12.
Worked samples
DuckDB 1.5.5 · finetype 0.6.64
| Value | As DATE |
|---|---|
| 15-01-2024 | 2024-01-15 |
| 31-12-2023 | 2023-12-31 |
| 01-06-2000 | 2000-06-01 |
- %d
- day of month, two digits
- %m
- month, two digits
- %Y
- four-digit year
Written by
CLDR 46 via finetype 0.6.64
Each locale below writes this format with its CLDR date pattern at the styles named beside it.
brx short · en (MV) medium · es (CL) medium · ia short · jv short · mi short · nl short · nl (AW, BQ, CW, SR, SX) short · rm medium · wo short
Shape
^\d{2}-\d{2}-\d{4}$| Value | Length | Shape |
|---|---|---|
| 15-01-2024 | 10 | matches |
| 31-12-2023 | 10 | matches |
| 01-06-2000 | 10 | matches |
| 15-01-202 | 9 | rejected: one character short |
Told apart
Going the other way, this type's own rule accepts 1 of 3 samples of MDY Date (dash-separated).
Ambiguous with mdy_dash when day <= 12.
Background
Origin
The Netherlands records dates in day–month–year order, with 31-12-1999 given as an example.[1] In Dutch date notation, dashes are typically used as separators, although slashes are used as well.[1] The List of date formats by country describes the Netherlands as using hyphens as in dd-mm-yyyy.[2] Unicode's CLDR gives Dutch (nl) the short Gregorian date pattern dd-MM-y.[3] CLDR gives Chilean Spanish (es-CL) the medium Gregorian date pattern dd-MM-y.[4]
In India, DD-MM-YYYY and DD/MM/YYYY are described as the two predominant short forms of the Gregorian date.[5] Indian usage takes both the hyphen and the oblique as the separator between date fields.[5]
Use
In Python's strptime format codes, %d is the day of the month as a zero-padded decimal number.[6] In Python's strptime format codes, %m is the month as a zero-padded decimal number.[6] In Python's strptime format codes, %Y is the year with century as a decimal number.[6] DuckDB's strptime function throws an error on failure.[7]
pandas.to_datetime with dayfirst=True parses 10/11/12 as 2012-11-10.[8] The pandas documentation warns that dayfirst=True is not strict, but will prefer to parse with day first.[8] A value such as 05-06-2024 reads equally well as 5 June or 6 May, so a column where no day exceeds 12 cannot be told apart from month-first dashed dates by its values alone; look for the file's documentation or its country of origin before you commit to an order. (Meridian's view)
Where you'll meet it
StatsWales's SW3 publishing platform accepts DD-MM-YYYY in data tables, with 01-01-2022 shown on the website as 1 January 2022.[9] SW3 also uses DD-MM-YYYY after a prefix for week-ending periods, so WE25-03-2022 is shown as week ending 25 March 2022.[9]
Sources
- [1]Date and time notation in the Netherlandssecondary source
- [2]List of date formats by countrysecondary source
- [3]ca-gregorian.jsondocumentation
- [4]ca-gregorian.json (es-CL)documentation
- [5]Date and time notation in Indiasecondary source
- [6]datetime — Basic date and time typesdocumentation
- [7]Date Format Functionsdocumentation
- [8]pandas.to_datetimedocumentation
- [9]Data preparation: New datasets | StatsWalesorganisation
Detection notes
New in format coverage expansion. Ambiguous with mdy_dash when day <= 12. Column-mode inference resolves via value distribution (if any day > 12, classify DMY).
Use it
$ finetype infer -i "15-01-2024" --mode column
→ datetime.date.dmy_dash
SELECT ft_infer('15-01-2024');
-- → 'datetime.date.dmy_dash'strptime({col}, '%d-%m-%Y')::DATE
-- Format: %d-%m-%YSchema
https://meridian.online/schemas/datetime.date.dmy_dash · Frictionless type date · %d-%m-%Y
finetype taxonomy datetime.date.dmy_dash -o json-schema