The ISO 8601 date format: what yyyy-mm-dd means, why it sorts correctly, who uses it, and how to write it in spreadsheets and code.
Last reviewed on 28 November 2026.
YYYY-MM-DD is a date written year first: four digits for the year, two for the month and two for the day, separated by hyphens. 2 October 2026 is 2026-10-02. It is the calendar date format defined by the international standard ISO 8601.
Today in YYYY-MM-DD:
2026-10-0201 (January) to 12 (December).01 to 31.The units run from largest to smallest, the same way a clock time runs from hours to seconds. That gives the format two properties no other common date format has: nobody reads it in a different order, and it sorts chronologically even when it is treated as plain text. Those two properties are why databases, APIs, file names and programmers use it.
Pick a date to see it written in YYYY-MM-DD, or paste a date to check that it is valid. Everything runs in your browser.
| Code | Meaning | Allowed values | In 2026-10-02 |
|---|---|---|---|
| YYYY | Year, four digits | 0000–9999 | 2026 |
| MM | Month number, two digits | 01–12 | 10 (October) |
| DD | Day of the month, two digits | 01–31 (01–28, 29 or 30 in shorter months) | 02 |
| - | Separator | A hyphen | - |
YYYY on its own simply means a year written with all four digits, such as 2026; YY means the last two, 26. A full YYYY-MM-DD date is always exactly ten characters.
| Date | YYYY-MM-DD | YYYYMMDD | YYYY/MM/DD |
|---|---|---|---|
| 1 January 2026 | 2026-01-01 | 20260101 | 2026/01/01 |
| 14 February 2026 | 2026-02-14 | 20260214 | 2026/02/14 |
| 29 February 2028 | 2028-02-29 | 20280229 | 2028/02/29 |
| 7 May 2007 | 2007-05-07 | 20070507 | 2007/05/07 |
| 2 October 2026 | 2026-10-02 | 20261002 | 2026/10/02 |
| 2 November 2026 | 2026-11-02 | 20261102 | 2026/11/02 |
| 25 December 2026 | 2026-12-25 | 20261225 | 2026/12/25 |
| 31 December 1999 | 1999-12-31 | 19991231 | 1999/12/31 |
26-10-02 is not ISO 8601 and could be read three different ways.2026-10-2 and 2026-3-05 are not valid.2026-10-02 is the extended format and 20261002 is the basic format. A mixture such as 2026-1002 is not allowed.2026-10 means October 2026. The standard does not allow 202610, because six digits would be confused with a YYMMDD date.2026-10-02T14:05:09Z. Times, time zones, week dates and durations are covered in the ISO 8601 guide.Because the biggest unit comes first and every part has a fixed width, alphabetical order and date order are the same thing. A folder of files named this way lists itself in date order with no extra work:
2025-12-31-report.pdf
2026-01-05-report.pdf
2026-10-02-report.pdf
2027-01-01-report.pdf
The same files named day first would sort as 01-01-2027, 02-10-2026, 05-01-2026, 31-12-2025, which is no order at all.
02/10/2026 is 2 October in London and February 10 in New York. 2026-10-02 is 2 October everywhere, because no country writes year-day-month.
<input type="date"> is always YYYY-MM-DD, whatever order the browser shows on screen.DATE '2026-10-02', and it is the default text form of the DATE type in MySQL and PostgreSQL.2026-10-02T14:05:09Z.date.isoformat() and Java's LocalDate.toString() produce it without a format string, and JavaScript's toISOString() starts with it.Year-month-day is the everyday order for well over a billion people, though the separator varies:
| Country | Typical form | 2 October 2026 |
|---|---|---|
| Sweden, Lithuania | YYYY-MM-DD | 2026-10-02 |
| China | YYYY-MM-DD or YYYY/MM/DD | 2026-10-02, also 2026年10月2日 |
| Japan, Taiwan | YYYY/MM/DD | 2026/10/02 |
| South Korea, Hungary | YYYY. MM. DD. | 2026. 10. 02. |
| Canada | YYYY-MM-DD (government recommendation) | 2026-10-02 |
| South Africa | YYYY/MM/DD or YYYY-MM-DD (official standard) | 2026/10/02 |
In most other countries it is the format of technical and official contexts rather than daily life. Germany, for example, recognises it alongside DD.MM.YYYY. See the country table for the full list.
| Pattern | 2 October 2026 | Notes |
|---|---|---|
| YYYY-MM-DD | 2026-10-02 | ISO 8601 extended format; the one to use by default |
| YYYYMMDD | 20261002 | ISO 8601 basic format; file names, batch files, database keys |
| YYYY/MM/DD | 2026/10/02 | Everyday form in Japan, Taiwan and South Africa; not ISO 8601 |
| YYYY.MM.DD | 2026.10.02 | Used in chess game records (PGN files, including Lichess studies), where unknown parts are written 2026.??.?? |
| YYYY-MM | 2026-10 | Month precision |
| YYYY-MM-DD HH:mm:ss | 2026-10-02 14:05:09 | The usual SQL timestamp layout; strict ISO 8601 puts a T where the space is |
| YY-MM-DD | 26-10-02 | Avoid: without the century it is ambiguous |
It is always YYYY-MM-DD. Year-day-month is not a standard and is not the convention of any country, so a date that starts with a four-digit year can be read as year, month, day. If you meet 2026-13-02, it is an error, not a different format. The one place the wrong reading can appear is old SQL Server code, described below.
yyyy-mm-dd. In a formula use =TEXT(A1,"yyyy-mm-dd").2026-10-02 as a date in every regional setting, which makes it the safe format for CSV files that will be opened in different countries.{ DATE \@ "yyyy-MM-dd" }, with a capital MM.Each line below prints 2026-10-02 for 2 October 2026.
| Language or tool | Format a date as YYYY-MM-DD | Pattern |
|---|---|---|
| Excel, Google Sheets | =TEXT(A1,"yyyy-mm-dd") | yyyy-mm-dd |
| JavaScript | d.toISOString().slice(0, 10) (UTC date) | none needed |
| Python | d.isoformat() or d.strftime('%Y-%m-%d') | %Y-%m-%d |
| Java | localDate.toString() or DateTimeFormatter.ISO_LOCAL_DATE | yyyy-MM-dd |
| C# / .NET | d.ToString("yyyy-MM-dd") | yyyy-MM-dd |
| PHP | $d->format('Y-m-d') | Y-m-d |
| MySQL | DATE_FORMAT(d, '%Y-%m-%d') | %Y-%m-%d |
| PostgreSQL, Oracle | TO_CHAR(d, 'YYYY-MM-DD') | YYYY-MM-DD |
| SQL Server | CONVERT(char(10), d, 23) | style 23 |
| Shell | date +%F | %F or %Y-%m-%d |
new Date('2026-10-02') is midnight UTC, which is still the evening of 1 October in the Americas, so printing it in local time shows the day before. Build local dates with new Date(2026, 9, 2).d.toLocaleDateString('sv-SE') gives 2026-10-02, because Sweden's everyday format is ISO.YYYY-MM-dd looks right all year and then prints the wrong year for a few days around 1 January. Use lowercase yyyy. The format codes page explains the pitfall.CAST('2026-10-02' AS datetime) becomes 10 February. The date and datetime2 types are not affected, and the unseparated form '20261002' is safe for every type.^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$
This checks the shape only: it accepts 2026-02-31. Follow it with a real date check, as the checker above does.
YYYY-MM-DD means year, month, day: a four-digit year, a two-digit month (01 to 12) and a two-digit day (01 to 31), separated by hyphens. 2 October 2026 is written 2026-10-02.
Christmas Day 2026 is 2026-12-25, New Year's Day 2026 is 2026-01-01 and 7 May 2007 is 2007-05-07. Month and day always have two digits.
Yes. It is the extended calendar date format of ISO 8601. The same standard also allows the basic format YYYYMMDD with no separators. Forms with slashes or dots, such as 2026/10/02, use the same order but are not ISO 8601.
Sweden and Lithuania use it in everyday life, and China, Japan, South Korea, Taiwan and Hungary write the year first with their own separators. Canada and South Africa recommend it officially. Elsewhere it is mainly used in technical, scientific and government contexts.
Because dates written YYYY-MM-DD sort chronologically as plain text, have a fixed length, and cannot be confused between day-first and month-first readers. That makes them reliable in file names, logs, databases and APIs.
YYYY-MM-DD. Year-day-month is not a standard and no country uses it, so a date that begins with a four-digit year is read as year, month, day.
YYYY means the year written with all four digits, such as 2026. YY means only the last two digits, 26. Four digits remove any doubt about the century.
Select the cells, press Ctrl+1, choose Custom and enter yyyy-mm-dd. To build the text in a formula, use =TEXT(A1,"yyyy-mm-dd").
Only the separator, but it matters to software. The hyphen form is the ISO 8601 standard and is understood by virtually every parser. The slash form is the everyday style in Japan and Taiwan and is not guaranteed to parse the same way everywhere.