YMD Date (dot-separated)
datetime.date.ymd_dotYear.Month.Day with dot separators. Unambiguous due to year-first ordering. Hungarian, Norwegian, and some East Asian administrative data.
Worked samples
DuckDB 1.5.5 · finetype 0.6.64
| Value | As DATE |
|---|---|
| 2024.01.15 | 2024-01-15 |
| 2023.12.31 | 2023-12-31 |
| 2000.06.01 | 2000-06-01 |
- %Y
- four-digit year
- %m
- month, two digits
- %d
- day of month, two digits
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.
mn short · mn (Mong-MN) short, medium
Shape
^\d{4}\.\d{2}\.\d{2}$| Value | Length | Shape |
|---|---|---|
| 2024.01.15 | 10 | matches |
| 2023.12.31 | 10 | matches |
| 2000.06.01 | 10 | matches |
| 2024.01.1 | 9 | rejected: one character short |
Background
Origin
In the Unicode CLDR locale data, the short date format for Mongolian (mn) is the pattern y.MM.dd.[1] In CLDR's date pattern syntax, MM is a numeric month of 2 digits, zero-padded if needed.[2] In CLDR's date pattern syntax, dd is a numeric day of the month of 2 digits, zero-padded if needed.[2] In CLDR's date pattern syntax, y is the calendar year written as a number, with examples running 2, 20, 201, 2017 and 20173.[2]
Wikipedia's list of date formats by country gives Mongolia's national standard format as yyyy-mm-dd, with leading zeroes.[3] Wikipedia's list of date formats by country says that in Mongolia many people casually use yyyy/(m)m/(d)d or yyyy.(m)m.(d)d, with or without leading zeroes.[3] In Mongolia the dotted year-first date is best read as an everyday variant that sits beside a dashed national standard, rather than a standard in its own right. (Meridian's view)
Use
Wikipedia's list of date formats by country says that in China many people casually use (yy)yy/(m)m/(d)d or (yy)yy.(m)m.(d)d, with or without leading zeroes.[3] A trailing full stop or a two-digit year is a sign you are looking at a neighbouring format, not this one. (Meridian's view)
DuckDB's strptime(text, format) function converts strings to timestamps according to the specified pattern.[4] DuckDB's documentation says to use the try_strptime function to return NULL on failure.[4] Parsing with try_strptime and the pattern %Y.%m.%d, then counting the NULLs, is a quick way to find the rows that do not fit before you commit to a cast. (Meridian's view)
Sources
- [1]ca-gregorian.json (mn)documentation
- [2]Unicode Locale Data Markup Language (LDML) Part 4: Datesstandard
- [3]List of date formats by countrysecondary source
- [4]Date Format Functionsdocumentation
Detection notes
New in format coverage expansion. Hungarian, Norwegian, East Asian systems.
Use it
$ finetype infer -i "2024.01.15" --mode column
→ datetime.date.ymd_dot
SELECT ft_infer('2024.01.15');
-- → 'datetime.date.ymd_dot'strptime({col}, '%Y.%m.%d')::DATE
-- Format: %Y.%m.%dSchema
https://meridian.online/schemas/datetime.date.ymd_dot · Frictionless type date · %Y.%m.%d
finetype taxonomy datetime.date.ymd_dot -o json-schema