Date Format Cheat Sheet

A side-by-side comparison of every common date and time format — with examples, format string patterns for JavaScript, Python, Java, C#, and SQL, and notes on where you'll encounter each one.


Why Date Formats Are a Mess

There is no single "correct" way to write a date. The United States uses month-first (06/29/2024). Most of Europe uses day-first (29.06.2024 or 29/06/2024). Japan and China use year-first (2024年6月29日). Databases use ISO format (2024-06-29). Unix systems use epoch seconds (1719619200). Email headers use RFC 2822 format (Sat, 29 Jun 2024 14:30:00 +0000).

Every format serves a purpose, and every system has opinions about which one to use. This cheat sheet puts them all in one place so you can quickly identify any format you encounter and find the right pattern to parse or generate it.

Date-Only Formats

FormatExampleUsed By
YYYY-MM-DD2024-06-29ISO 8601, SQL DATE, HTML <input type="date">
MM/DD/YYYY06/29/2024United States, Philippines
M/D/YYYY6/29/2024US informal, Excel (US locale)
DD/MM/YYYY29/06/2024UK, Australia, most of Europe, India
DD.MM.YYYY29.06.2024Germany, Russia, much of continental Europe
YYYY.MM.DD2024.06.29China, Korea, Hungary
MMM DD, YYYYJun 29, 2024US formal/editorial, AP style
DD MMM YYYY29 Jun 2024UK formal, military, RFC 2822 (email)
MMMM DD, YYYYJune 29, 2024US long-form, legal documents

Date + Time Formats

FormatExampleUsed By
YYYY-MM-DDTHH:mm:ssZ2024-06-29T14:30:00ZISO 8601, REST APIs, JSON
YYYY-MM-DDTHH:mm:ss.SSSZ2024-06-29T14:30:00.000ZJavaScript toISOString(), Java
YYYY-MM-DDTHH:mm:ss±HH:mm2024-06-29T14:30:00+05:30ISO 8601 with offset, RFC 3339
YYYY-MM-DD HH:mm:ss2024-06-29 14:30:00SQL DATETIME, Python str(), database exports
MM/DD/YYYY HH:mm:ss06/29/2024 14:30:00US 24-hour, log files
M/D/YYYY h:mm:ss A6/29/2024 2:30:00 PMUS 12-hour, Excel (US locale)
DD.MM.YYYY, HH:mm:ss29.06.2024, 14:30:00German/European with time
Unix (seconds)1719619200Unix/Linux, databases, APIs
Unix (milliseconds)1719619200000JavaScript, Java, analytics platforms
MMM DD, YYYY, h:mm:ss AJun 29, 2024, 2:30:00 PMUS verbose, Salesforce, CRM exports
MMMM DD, YYYY at h:mm AJune 29, 2024 at 2:30 PMApple/iOS, verbose UI display

Format String Patterns by Language

Different languages use different tokens in their format strings. Here's a Rosetta Stone for the most common date formatting patterns:

Date: June 29, 2024

ComponentJavaScript (Intl/Luxon)Python (strftime)Java (DateTimeFormatter)C# (.NET)
4-digit yearyyyy%Yyyyyyyyy
2-digit yearyy%yyyyy
Month (01–12)MM%mMMMM
Month (1–12)M%-mMM
Month name (Jun)MMM%bMMMMMM
Month name (June)MMMM%BMMMMMMMM
Day (01–31)dd%ddddd
Day (1–31)d%-ddd
Hour 24h (00–23)HH%HHHHH
Hour 12h (01–12)hh%Ihhhh
Minute (00–59)mm%Mmmmm
Second (00–59)ss%Sssss
MillisecondsSSS%f (microseconds)SSSfff
AM/PMa%patt
Timezone offsetZZ%zXXXzzz

Example: Format "June 29, 2024 2:30 PM"

// JavaScript (Luxon)
DateTime.now().toFormat('MMMM dd, yyyy h:mm a')

# Python
datetime.now().strftime('%B %d, %Y %-I:%M %p')

// Java
DateTimeFormatter.ofPattern("MMMM dd, yyyy h:mm a")

// C#
DateTime.Now.ToString("MMMM dd, yyyy h:mm tt")

Example: Format "2024-06-29T14:30:00Z" (ISO 8601)

// JavaScript
new Date().toISOString()

# Python
from datetime import datetime, timezone
datetime.now(timezone.utc).isoformat()

// Java
Instant.now().toString()

// C#
DateTime.UtcNow.ToString("o")

SQL Date Functions

TaskMySQLPostgreSQLSQLite
Current timestampNOW()NOW()datetime('now')
Format dateDATE_FORMAT(d, '%Y-%m-%d')TO_CHAR(d, 'YYYY-MM-DD')strftime('%Y-%m-%d', d)
Parse stringSTR_TO_DATE(s, '%m/%d/%Y')TO_DATE(s, 'MM/DD/YYYY')(use strftime)
Unix → datetimeFROM_UNIXTIME(ts)TO_TIMESTAMP(ts)datetime(ts, 'unixepoch')
Datetime → UnixUNIX_TIMESTAMP(d)EXTRACT(EPOCH FROM d)strftime('%s', d)

The Ambiguous Six: Dates That Parse Differently by Locale

These date strings are valid in multiple formats but mean different things depending on interpretation. They're the most common source of date bugs in international systems:

StringUS Interpretation (M/D/Y)European Interpretation (D/M/Y)
01/02/2024January 2, 2024February 1, 2024
03/04/2024March 4, 2024April 3, 2024
05/06/2024May 6, 2024June 5, 2024
07/08/2024July 8, 2024August 7, 2024
09/10/2024September 10, 2024October 9, 2024
11/12/2024November 12, 2024December 11, 2024

Any date where both the day and month are 12 or below is inherently ambiguous in slash-separated formats. The only reliable way to avoid this is to use ISO 8601 (2024-06-29), include a month name (Jun 29, 2024), or know the source system's locale with certainty.

How Auto-Detection Works

When you paste a date into a converter that auto-detects the format, it uses pattern matching and heuristics:

Unambiguous signals: The letter T between date and time components signals ISO 8601. A trailing Z or UTC offset (+05:30) confirms it. A 10-digit number is almost certainly a Unix timestamp in seconds. A 13-digit number is milliseconds. Month names (Jun, June) eliminate month/day ambiguity.

Ambiguous cases: When faced with 06/29/2024, the detector knows the day is 29 (which exceeds 12), so the first component must be the month — this is M/D/Y format. But 06/07/2024 could be either M/D/Y or D/M/Y. Most auto-detectors default to the locale of the user or the system, or ask the user to confirm.

Separator clues: Dashes (-) with year-first suggest ISO 8601. Dots (.) suggest European format. Slashes (/) suggest US or UK format depending on the order. Commas after a month name suggest US verbose format.

Best Practices

Store dates as ISO 8601 or Unix timestamps. Both are unambiguous, sortable, and universally parseable. Use ISO 8601 when human readability in the database matters. Use Unix timestamps when you want the simplest possible storage and comparison.

Always include timezone information. A datetime without a timezone is an accident waiting to happen. Use Z for UTC, or include the offset. If storing in a database, use TIMESTAMP WITH TIME ZONE (PostgreSQL) or always store in UTC.

Format for display at the last moment. Store and transmit dates in a canonical format (ISO 8601 or timestamps). Convert to the user's local format only at the point of display.

Validate on input. If your system accepts dates from users, validate that the input matches the expected format. Don't rely on "flexible parsing" that silently interprets 02/03/2024 as March 2nd when the user meant February 3rd.

Related Guides

For a deep dive on Unix timestamps specifically, see What Is a Unix Timestamp?. For the full ISO 8601 standard explained, see ISO 8601 Explained. For timezone abbreviations and their offsets, see the Timezone Abbreviations Reference. To apply all of this to real data, see How to Convert Dates in CSV Files. For the email date format (RFC 2822), see RFC 2822: The Email Standard.

Try It Yourself

Convert any date or timestamp instantly — free, no sign-up required.

Open the Converter