Short Date (Year-Month-Day, 2-digit year)
datetime.date.short_ymdTwo-digit year, year-first (ISO-like ordering). Dash-separated.
Operations on this type: Parse a date or time
Try a value
Short Date (Year-Month-Day, 2-digit year)'s rule accepts it.
Reads it as 2024-03-04
Also accepted by
- Short Date (Day-Month-Year, 2-digit year)
2004-03-24
Use it
finetype infer -i '24-01-15' --mode column
# → datetime.date.short_ymdSELECT ft_infer('24-01-15');
-- → 'datetime.date.short_ymd'strptime({col}, '%y-%m-%d')::DATE
-- Format: %y-%m-%dHow finetype reads the samples
DuckDB 1.5.5 · finetype 0.6.66
| Value | As DATE |
|---|---|
| 24-01-15 | 2024-01-15 |
| 99-12-31 | 1999-12-31 |
- %y
- two-digit year
- %m
- month, two digits
- %d
- day of month, two digits
Written by
CLDR 46 via finetype 0.6.66
Each locale below writes this format with its CLDR date pattern at the styles named beside it.
eo short
Pattern
^\d{2}-\d{2}-\d{2}$| Value | Length | Shape |
|---|---|---|
| 24-01-15 | 8 | matches |
| 99-12-31 | 8 | matches |
| 24-01-1 | 7 | rejected: one character short |
Similar types
Going the other way, this type's own rule accepts 1 of 2 samples of Short Date (Day-Month-Year, 2-digit year).
Background
Origin
ISO 8601:2000 allowed truncated representations by agreement, in which leading components of a date or time are omitted.[1] The truncation provision of ISO 8601:2000 allowed two-digit years, including the YY-MM-DD format.[1] The truncation provision was removed in ISO 8601:2004.[1] ISO 8601 prescribes a four-digit year as a minimum, to avoid the year 2000 problem.[1]
RFC 3339, Date and Time on the Internet: Timestamps, says the use of 2-digit years is deprecated.[2] RFC 3339 requires Internet protocols to generate four digit years in dates.[2]
Use
Wikipedia's article on Swedish date notation says Swedish dates can be shortened to two-digit years, written in the form YY-MM-DD.[3]
Python's time.strptime maps two-digit years 69–99 to 1969–1999 and 0–68 to 2000–2068.[4] Python's documentation says that two-digit year conversion follows the POSIX and ISO C standards.[4] DuckDB's %y specifier turns the numbers 00 to 68 into 2000 to 2068, and 69 to 99 into 1969 to 1999.[5] Before casting, compare the range of years a file should cover with the pivot your parser uses, and supply the century yourself when the two disagree. (Meridian's view)
RFC 3339 says a received 2-digit year should be accepted only if an incorrect interpretation will not cause a protocol or processing failure.[2] A value like 05-06-07 reads equally well as year-month-day, day-month-year or month-day-year, so judge the order from a whole column of values rather than from one. (Meridian's view)
Where you'll meet it
The Unicode CLDR locale data gives Esperanto's short date format as yy-MM-dd.[6]
Sources
- [1]ISO 8601secondary source
- [2]RFC 3339: Date and Time on the Internet: Timestampsstandard
- [3]Date and time notation in Swedensecondary source
- [4]time — Time access and conversionsdocumentation
- [5]Date Format Functionsdocumentation
- [6]cldr-json/cldr-dates-full/main/eo/ca-gregorian.jsondataset
Schema
https://meridian.online/schemas/datetime.date.short_ymd · Frictionless type date · %y-%m-%d
finetype taxonomy datetime.date.short_ymd -o json-schema