Date Format Cheat Sheet
Every date format code for Python strftime, Java, C#, date-fns, Moment, PHP, MySQL and PostgreSQL, with examples and common formats.
Runs in your browser. Nothing is uploaded.
Examples show Wednesday 4 March 2026, 15:07:09.123456 in India (UTC+05:30, IST).
DateTimeFormatter.ofPattern("yyyy-MM-dd").format(dateTime)| Code | Meaning | Example |
|---|---|---|
yyyy | Year, 4 digits | 2026 |
yy | Year, 2 digits | 26 |
M | Month number (1–12) | 3 |
MM | Month number, 2 digits (01–12) | 03 |
MMM | Month name, short (Mar) | Mar |
MMMM | Month name, full (March) | March |
d | Day of the month (1–31) | 4 |
dd | Day of the month, 2 digits (01–31) | 04 |
DDD | Day of the year, 3 digits (001–366) | 063 |
EEE | Weekday, short (Wed) | Wed |
EEEE | Weekday, full (Wednesday) | Wednesday |
H | Hour, 24-hour clock (0–23) | 15 |
HH | Hour, 24-hour clock, 2 digits (00–23) | 15 |
h | Hour, 12-hour clock (1–12) | 3 |
hh | Hour, 12-hour clock, 2 digits (01–12) | 03 |
m | Minute (0–59) | 7 |
mm | Minute, 2 digits (00–59) | 07 |
s | Second (0–59) | 9 |
ss | Second, 2 digits (00–59) | 09 |
SSS | Milliseconds, 3 digits | 123 |
SSSSSS | Microseconds, 6 digits | 123456 |
a | AM / PM | PM |
XXX | UTC offset, Z for zero (Z, +05:30) | +05:30 |
xxx | UTC offset with colon (+05:30) | +05:30 |
xx | UTC offset without colon (+0530) | +0530 |
z | Time zone abbreviation (IST)Needs a ZonedDateTime. | IST |
No code in Java (DateTimeFormatter): iso weekday number (1 = monday … 7 = sunday); iso week number, 2 digits (01–53); iso week-numbering year; unix timestamp, seconds; unix timestamp, milliseconds.
Common formats in Java (DateTimeFormatter)
| Format | Pattern | Example |
|---|---|---|
| ISO 8601 date | yyyy-MM-dd | 2026-03-04 |
| ISO 8601 date and time with offset | yyyy-MM-dd'T'HH:mm:ssxxx | 2026-03-04T15:07:09+05:30 |
| SQL datetime | yyyy-MM-dd HH:mm:ss | 2026-03-04 15:07:09 |
| Day first (Europe, Asia, Latin America) | dd/MM/yyyy | 04/03/2026 |
| Month first (United States) | MM/dd/yyyy | 03/04/2026 |
| Written out | d MMMM yyyy | 4 March 2026 |
| Weekday and date | EEEE, d MMMM yyyy | Wednesday, 4 March 2026 |
| 12-hour time | h:mm a | 3:07 PM |
| RFC 2822 (email, RSS) | EEE, dd MMM yyyy HH:mm:ss xx | Wed, 04 Mar 2026 15:07:09 +0530 |
| Timestamp for file names | yyyyMMdd_HHmmss | 20260304_150709 |
format(date, 'yyyy-MM-dd')| Code | Meaning | Example |
|---|---|---|
yyyy | Year, 4 digits | 2026 |
yy | Year, 2 digits | 26 |
M | Month number (1–12) | 3 |
MM | Month number, 2 digits (01–12) | 03 |
MMM | Month name, short (Mar) | Mar |
MMMM | Month name, full (March) | March |
d | Day of the month (1–31) | 4 |
dd | Day of the month, 2 digits (01–31) | 04 |
DDD | Day of the year, 3 digits (001–366)date-fns needs the useAdditionalDayOfYearTokens option for D and DD. | 063 |
EEE | Weekday, short (Wed) | Wed |
EEEE | Weekday, full (Wednesday) | Wednesday |
i | ISO weekday number (1 = Monday … 7 = Sunday) | 3 |
II | ISO week number, 2 digits (01–53) | 10 |
RRRR | ISO week-numbering year | 2026 |
H | Hour, 24-hour clock (0–23) | 15 |
HH | Hour, 24-hour clock, 2 digits (00–23) | 15 |
h | Hour, 12-hour clock (1–12) | 3 |
hh | Hour, 12-hour clock, 2 digits (01–12) | 03 |
m | Minute (0–59) | 7 |
mm | Minute, 2 digits (00–59) | 07 |
s | Second (0–59) | 9 |
ss | Second, 2 digits (00–59) | 09 |
SSS | Milliseconds, 3 digits | 123 |
SSSSSS | Microseconds, 6 digitsJavaScript dates only store milliseconds. | 123456 |
a | AM / PM | PM |
XXX | UTC offset, Z for zero (Z, +05:30) | +05:30 |
xxx | UTC offset with colon (+05:30) | +05:30 |
xx | UTC offset without colon (+0530) | +0530 |
t | Unix timestamp, seconds | 1772617029 |
T | Unix timestamp, milliseconds | 1772617029123 |
No code in JavaScript (date-fns): time zone abbreviation (ist).
Common formats in JavaScript (date-fns)
| Format | Pattern | Example |
|---|---|---|
| ISO 8601 date | yyyy-MM-dd | 2026-03-04 |
| ISO 8601 date and time with offset | yyyy-MM-dd'T'HH:mm:ssxxx | 2026-03-04T15:07:09+05:30 |
| SQL datetime | yyyy-MM-dd HH:mm:ss | 2026-03-04 15:07:09 |
| Day first (Europe, Asia, Latin America) | dd/MM/yyyy | 04/03/2026 |
| Month first (United States) | MM/dd/yyyy | 03/04/2026 |
| Written out | d MMMM yyyy | 4 March 2026 |
| Weekday and date | EEEE, d MMMM yyyy | Wednesday, 4 March 2026 |
| 12-hour time | h:mm a | 3:07 PM |
| RFC 2822 (email, RSS) | EEE, dd MMM yyyy HH:mm:ss xx | Wed, 04 Mar 2026 15:07:09 +0530 |
| Timestamp for file names | yyyyMMdd_HHmmss | 20260304_150709 |
dayjs(date).format('YYYY-MM-DD')| Code | Meaning | Example |
|---|---|---|
YYYY | Year, 4 digits | 2026 |
YY | Year, 2 digits | 26 |
M | Month number (1–12) | 3 |
MM | Month number, 2 digits (01–12) | 03 |
MMM | Month name, short (Mar) | Mar |
MMMM | Month name, full (March) | March |
D | Day of the month (1–31) | 4 |
DD | Day of the month, 2 digits (01–31) | 04 |
DDDD | Day of the year, 3 digits (001–366) | 063 |
ddd | Weekday, short (Wed) | Wed |
dddd | Weekday, full (Wednesday) | Wednesday |
E | ISO weekday number (1 = Monday … 7 = Sunday) | 3 |
WW | ISO week number, 2 digits (01–53) | 10 |
GGGG | ISO week-numbering year | 2026 |
H | Hour, 24-hour clock (0–23) | 15 |
HH | Hour, 24-hour clock, 2 digits (00–23) | 15 |
h | Hour, 12-hour clock (1–12) | 3 |
hh | Hour, 12-hour clock, 2 digits (01–12) | 03 |
m | Minute (0–59) | 7 |
mm | Minute, 2 digits (00–59) | 07 |
s | Second (0–59) | 9 |
ss | Second, 2 digits (00–59) | 09 |
SSS | Milliseconds, 3 digits | 123 |
SSSSSS | Microseconds, 6 digitsJavaScript dates only store milliseconds. | 123456 |
A | AM / PM | PM |
Z | UTC offset with colon (+05:30) | +05:30 |
ZZ | UTC offset without colon (+0530) | +0530 |
z | Time zone abbreviation (IST)Needs moment-timezone (or the Day.js timezone plugin). | IST |
X | Unix timestamp, seconds | 1772617029 |
x | Unix timestamp, milliseconds | 1772617029123 |
No code in JavaScript (Moment.js, Day.js): utc offset, z for zero (z, +05:30).
Common formats in JavaScript (Moment.js, Day.js)
| Format | Pattern | Example |
|---|---|---|
| ISO 8601 date | YYYY-MM-DD | 2026-03-04 |
| ISO 8601 date and time with offset | YYYY-MM-DD[T]HH:mm:ssZ | 2026-03-04T15:07:09+05:30 |
| SQL datetime | YYYY-MM-DD HH:mm:ss | 2026-03-04 15:07:09 |
| Day first (Europe, Asia, Latin America) | DD/MM/YYYY | 04/03/2026 |
| Month first (United States) | MM/DD/YYYY | 03/04/2026 |
| Written out | D MMMM YYYY | 4 March 2026 |
| Weekday and date | dddd, D MMMM YYYY | Wednesday, 4 March 2026 |
| 12-hour time | h:mm A | 3:07 PM |
| RFC 2822 (email, RSS) | ddd, DD MMM YYYY HH:mm:ss ZZ | Wed, 04 Mar 2026 15:07:09 +0530 |
| Timestamp for file names | YYYYMMDD_HHmmss | 20260304_150709 |
date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)| Code | Meaning | Example |
|---|---|---|
yyyy | Year, 4 digits | 2026 |
yy | Year, 2 digits | 26 |
M | Month number (1–12) | 3 |
MM | Month number, 2 digits (01–12) | 03 |
MMM | Month name, short (Mar) | Mar |
MMMM | Month name, full (March) | March |
d | Day of the month (1–31)A pattern of only "d" means the short date format; use "%d" on its own. | 4 |
dd | Day of the month, 2 digits (01–31) | 04 |
ddd | Weekday, short (Wed) | Wed |
dddd | Weekday, full (Wednesday) | Wednesday |
H | Hour, 24-hour clock (0–23) | 15 |
HH | Hour, 24-hour clock, 2 digits (00–23) | 15 |
h | Hour, 12-hour clock (1–12) | 3 |
hh | Hour, 12-hour clock, 2 digits (01–12) | 03 |
m | Minute (0–59) | 7 |
mm | Minute, 2 digits (00–59) | 07 |
s | Second (0–59) | 9 |
ss | Second, 2 digits (00–59) | 09 |
fff | Milliseconds, 3 digits | 123 |
ffffff | Microseconds, 6 digits | 123456 |
tt | AM / PM | PM |
K | UTC offset, Z for zero (Z, +05:30)K prints Z only for DateTime values of kind Utc. | +05:30 |
zzz | UTC offset with colon (+05:30) | +05:30 |
No code in C# / .NET: day of the year, 3 digits (001–366); iso weekday number (1 = monday … 7 = sunday); iso week number, 2 digits (01–53); iso week-numbering year; utc offset without colon (+0530); time zone abbreviation (ist); unix timestamp, seconds; unix timestamp, milliseconds.
Common formats in C# / .NET
| Format | Pattern | Example |
|---|---|---|
| ISO 8601 date | yyyy-MM-dd | 2026-03-04 |
| ISO 8601 date and time with offset | yyyy-MM-dd'T'HH:mm:sszzz | 2026-03-04T15:07:09+05:30 |
| SQL datetime | yyyy-MM-dd HH:mm:ss | 2026-03-04 15:07:09 |
| Day first (Europe, Asia, Latin America) | dd/MM/yyyy | 04/03/2026 |
| Month first (United States) | MM/dd/yyyy | 03/04/2026 |
| Written out | d MMMM yyyy | 4 March 2026 |
| Weekday and date | dddd, d MMMM yyyy | Wednesday, 4 March 2026 |
| 12-hour time | h:mm tt | 3:07 PM |
| Timestamp for file names | yyyyMMdd_HHmmss | 20260304_150709 |
dt.strftime("%Y-%m-%d")| Code | Meaning | Example |
|---|---|---|
%Y | Year, 4 digits | 2026 |
%y | Year, 2 digits | 26 |
%-m | Month number (1–12)Linux and macOS only; on Windows use # instead of -. | 3 |
%m | Month number, 2 digits (01–12) | 03 |
%b | Month name, short (Mar) | Mar |
%B | Month name, full (March) | March |
%-d | Day of the month (1–31)Linux and macOS only; on Windows use # instead of -. | 4 |
%d | Day of the month, 2 digits (01–31) | 04 |
%j | Day of the year, 3 digits (001–366) | 063 |
%a | Weekday, short (Wed) | Wed |
%A | Weekday, full (Wednesday) | Wednesday |
%u | ISO weekday number (1 = Monday … 7 = Sunday) | 3 |
%V | ISO week number, 2 digits (01–53) | 10 |
%G | ISO week-numbering year | 2026 |
%-H | Hour, 24-hour clock (0–23)Linux and macOS only; on Windows use # instead of -. | 15 |
%H | Hour, 24-hour clock, 2 digits (00–23) | 15 |
%-I | Hour, 12-hour clock (1–12)Linux and macOS only; on Windows use # instead of -. | 3 |
%I | Hour, 12-hour clock, 2 digits (01–12) | 03 |
%-M | Minute (0–59)Linux and macOS only; on Windows use # instead of -. | 7 |
%M | Minute, 2 digits (00–59) | 07 |
%-S | Second (0–59)Linux and macOS only; on Windows use # instead of -. | 9 |
%S | Second, 2 digits (00–59) | 09 |
%f | Microseconds, 6 digits | 123456 |
%p | AM / PM | PM |
%:z | UTC offset with colon (+05:30)Python 3.12 and later. | +05:30 |
%z | UTC offset without colon (+0530) | +0530 |
%Z | Time zone abbreviation (IST)Empty for naive datetimes. | IST |
%s | Unix timestamp, secondsNot official and platform-dependent; prefer int(dt.timestamp()). | 1772617029 |
No code in Python (strftime): milliseconds, 3 digits; utc offset, z for zero (z, +05:30); unix timestamp, milliseconds.
Common formats in Python (strftime)
| Format | Pattern | Example |
|---|---|---|
| ISO 8601 date | %Y-%m-%d | 2026-03-04 |
| ISO 8601 date and time with offset | %Y-%m-%dT%H:%M:%S%:z | 2026-03-04T15:07:09+05:30 |
| SQL datetime | %Y-%m-%d %H:%M:%S | 2026-03-04 15:07:09 |
| Day first (Europe, Asia, Latin America) | %d/%m/%Y | 04/03/2026 |
| Month first (United States) | %m/%d/%Y | 03/04/2026 |
| Written out | %-d %B %Y | 4 March 2026 |
| Weekday and date | %A, %-d %B %Y | Wednesday, 4 March 2026 |
| 12-hour time | %-I:%M %p | 3:07 PM |
| RFC 2822 (email, RSS) | %a, %d %b %Y %H:%M:%S %z | Wed, 04 Mar 2026 15:07:09 +0530 |
| Timestamp for file names | %Y%m%d_%H%M%S | 20260304_150709 |
date('Y-m-d', $timestamp)| Code | Meaning | Example |
|---|---|---|
Y | Year, 4 digits | 2026 |
y | Year, 2 digits | 26 |
n | Month number (1–12) | 3 |
m | Month number, 2 digits (01–12) | 03 |
M | Month name, short (Mar) | Mar |
F | Month name, full (March) | March |
j | Day of the month (1–31) | 4 |
d | Day of the month, 2 digits (01–31) | 04 |
D | Weekday, short (Wed) | Wed |
l | Weekday, full (Wednesday) | Wednesday |
N | ISO weekday number (1 = Monday … 7 = Sunday) | 3 |
W | ISO week number, 2 digits (01–53) | 10 |
o | ISO week-numbering year | 2026 |
G | Hour, 24-hour clock (0–23) | 15 |
H | Hour, 24-hour clock, 2 digits (00–23) | 15 |
g | Hour, 12-hour clock (1–12) | 3 |
h | Hour, 12-hour clock, 2 digits (01–12) | 03 |
i | Minute, 2 digits (00–59) | 07 |
s | Second, 2 digits (00–59) | 09 |
v | Milliseconds, 3 digits | 123 |
u | Microseconds, 6 digitsdate() always prints 000000; use DateTime::format. | 123456 |
A | AM / PM | PM |
p | UTC offset, Z for zero (Z, +05:30)PHP 8.0 and later. | +05:30 |
P | UTC offset with colon (+05:30) | +05:30 |
O | UTC offset without colon (+0530) | +0530 |
T | Time zone abbreviation (IST) | IST |
U | Unix timestamp, seconds | 1772617029 |
No code in PHP (date): day of the year, 3 digits (001–366); minute (0–59); second (0–59); unix timestamp, milliseconds.
Common formats in PHP (date)
| Format | Pattern | Example |
|---|---|---|
| ISO 8601 date | Y-m-d | 2026-03-04 |
| ISO 8601 date and time with offset | Y-m-d\TH:i:sP | 2026-03-04T15:07:09+05:30 |
| SQL datetime | Y-m-d H:i:s | 2026-03-04 15:07:09 |
| Day first (Europe, Asia, Latin America) | d/m/Y | 04/03/2026 |
| Month first (United States) | m/d/Y | 03/04/2026 |
| Written out | j F Y | 4 March 2026 |
| Weekday and date | l, j F Y | Wednesday, 4 March 2026 |
| 12-hour time | g:i A | 3:07 PM |
| RFC 2822 (email, RSS) | D, d M Y H:i:s O | Wed, 04 Mar 2026 15:07:09 +0530 |
| Timestamp for file names | Ymd_His | 20260304_150709 |
DATE_FORMAT(created_at, '%Y-%m-%d')| Code | Meaning | Example |
|---|---|---|
%Y | Year, 4 digits | 2026 |
%y | Year, 2 digits | 26 |
%c | Month number (1–12) | 3 |
%m | Month number, 2 digits (01–12) | 03 |
%b | Month name, short (Mar) | Mar |
%M | Month name, full (March)In MySQL %M is the month name, not minutes (minutes are %i). | March |
%e | Day of the month (1–31) | 4 |
%d | Day of the month, 2 digits (01–31) | 04 |
%j | Day of the year, 3 digits (001–366) | 063 |
%a | Weekday, short (Wed) | Wed |
%W | Weekday, full (Wednesday) | Wednesday |
%v | ISO week number, 2 digits (01–53) | 10 |
%x | ISO week-numbering year | 2026 |
%k | Hour, 24-hour clock (0–23) | 15 |
%H | Hour, 24-hour clock, 2 digits (00–23) | 15 |
%l | Hour, 12-hour clock (1–12) | 3 |
%h | Hour, 12-hour clock, 2 digits (01–12) | 03 |
%i | Minute, 2 digits (00–59) | 07 |
%s | Second, 2 digits (00–59) | 09 |
%f | Microseconds, 6 digits | 123456 |
%p | AM / PM | PM |
No code in SQL: MySQL / MariaDB (DATE_FORMAT): iso weekday number (1 = monday … 7 = sunday); minute (0–59); second (0–59); milliseconds, 3 digits; utc offset, z for zero (z, +05:30); utc offset with colon (+05:30); utc offset without colon (+0530); time zone abbreviation (ist); unix timestamp, seconds; unix timestamp, milliseconds.
Common formats in SQL: MySQL / MariaDB (DATE_FORMAT)
| Format | Pattern | Example |
|---|---|---|
| ISO 8601 date | %Y-%m-%d | 2026-03-04 |
| SQL datetime | %Y-%m-%d %H:%i:%s | 2026-03-04 15:07:09 |
| Day first (Europe, Asia, Latin America) | %d/%m/%Y | 04/03/2026 |
| Month first (United States) | %m/%d/%Y | 03/04/2026 |
| Written out | %e %M %Y | 4 March 2026 |
| Weekday and date | %W, %e %M %Y | Wednesday, 4 March 2026 |
| 12-hour time | %l:%i %p | 3:07 PM |
| Timestamp for file names | %Y%m%d_%H%i%s | 20260304_150709 |
TO_CHAR(created_at, 'YYYY-MM-DD')| Code | Meaning | Example |
|---|---|---|
YYYY | Year, 4 digits | 2026 |
YY | Year, 2 digits | 26 |
FMMM | Month number (1–12)FM removes the leading zero. | 3 |
MM | Month number, 2 digits (01–12) | 03 |
Mon | Month name, short (Mar) | Mar |
FMMonth | Month name, full (March)Without FM, Month is padded with spaces to 9 characters. | March |
FMDD | Day of the month (1–31) | 4 |
DD | Day of the month, 2 digits (01–31) | 04 |
DDD | Day of the year, 3 digits (001–366) | 063 |
Dy | Weekday, short (Wed) | Wed |
FMDay | Weekday, full (Wednesday)Without FM, Day is padded with spaces to 9 characters. | Wednesday |
ID | ISO weekday number (1 = Monday … 7 = Sunday) | 3 |
IW | ISO week number, 2 digits (01–53) | 10 |
IYYY | ISO week-numbering year | 2026 |
FMHH24 | Hour, 24-hour clock (0–23) | 15 |
HH24 | Hour, 24-hour clock, 2 digits (00–23) | 15 |
FMHH12 | Hour, 12-hour clock (1–12) | 3 |
HH12 | Hour, 12-hour clock, 2 digits (01–12)HH on its own is also the 12-hour clock. | 03 |
FMMI | Minute (0–59) | 7 |
MI | Minute, 2 digits (00–59) | 07 |
FMSS | Second (0–59) | 9 |
SS | Second, 2 digits (00–59) | 09 |
MS | Milliseconds, 3 digits | 123 |
US | Microseconds, 6 digits | 123456 |
AM | AM / PM | PM |
TZH:TZM | UTC offset with colon (+05:30)Needs a timestamptz value. | +05:30 |
TZ | Time zone abbreviation (IST) | IST |
No code in SQL: PostgreSQL / Oracle (TO_CHAR): utc offset, z for zero (z, +05:30); utc offset without colon (+0530); unix timestamp, seconds; unix timestamp, milliseconds.
Common formats in SQL: PostgreSQL / Oracle (TO_CHAR)
| Format | Pattern | Example |
|---|---|---|
| ISO 8601 date | YYYY-MM-DD | 2026-03-04 |
| ISO 8601 date and time with offset | YYYY-MM-DD"T"HH24:MI:SSTZH:TZM | 2026-03-04T15:07:09+05:30 |
| SQL datetime | YYYY-MM-DD HH24:MI:SS | 2026-03-04 15:07:09 |
| Day first (Europe, Asia, Latin America) | DD/MM/YYYY | 04/03/2026 |
| Month first (United States) | MM/DD/YYYY | 03/04/2026 |
| Written out | FMDD FMMonth YYYY | 4 March 2026 |
| Weekday and date | FMDay, FMDD FMMonth YYYY | Wednesday, 4 March 2026 |
| 12-hour time | FMHH12:MI AM | 3:07 PM |
| Timestamp for file names | YYYYMMDD_HH24MISS | 20260304_150709 |
No code matches that search in this language.
How to use the Date Format Cheat Sheet
- Choose your Language, for example Python (strftime), Java or MySQL.
- Scan the table for the part of the date you need, or type a word like
monthor a code like%dunder Find a code. - Check the Example column to see exactly what the code prints for 4 March 2026, 15:07:09.
- Copy a ready-made pattern from Common formats, such as ISO 8601 or RFC 2822.
Every date code in one place
Date format codes are easy to forget and easy to confuse between languages. This cheat sheet lists
the codes for eight common ones: Python’s strftime, Java’s DateTimeFormatter (the same letters
work for SimpleDateFormat in most cases), C# / .NET custom format strings, the JavaScript
libraries date-fns, Moment.js and Day.js, PHP’s date(), MySQL’s DATE_FORMAT and PostgreSQL’s
(and Oracle’s) TO_CHAR.
Every table shows the same sample moment, Wednesday 4 March 2026 at 15:07:09.123456 in India (UTC+05:30), so you can compare codes side by side: a single-digit day and month show whether a code pads with zeros, and the afternoon time shows 24-hour against 12-hour codes.
Common formats, ready to copy
Under each table you’ll find patterns for the formats people need most: ISO 8601 dates and timestamps for APIs, the SQL datetime format, day-first and US month-first dates, written-out dates, 12-hour times, RFC 2822 for email and RSS, and a compact timestamp for file names. A line of code at the top shows how the pattern is used in that language.
Pitfalls to watch for
- Minutes or month:
mm/MMin Java, C#, date-fns and Moment;%M/%min Python;%i/%min MySQL. - Week year:
YYYYin Java and date-fns is the ISO week-based year. Useyyyy. - Day of year:
DDandDin Java and date-fns are the day of the year, not the month. - Padding: PostgreSQL pads
MonthandDaywith spaces unless you addFM. - Platform codes: Python’s
%-dworks on Linux and macOS; Windows uses%#d.
To try a pattern on any date, or convert it to another language, use the Date Pattern Tester.
Frequently asked questions
What is the difference between %m and %M in Python?
%m is the month as two digits (03) and %M is the minutes (07). In MySQL it is different again: %M is the month name and minutes are %i.
Why do Java and C# use yyyy but Moment uses YYYY?
Each library chose its own letters. In Java and date-fns YYYY is the week-based year, which is wrong for normal dates, while in Moment and Day.js YYYY is the normal year. Check the table for your language.
How do I print literal text such as the T in ISO dates?
Quote it. Java, date-fns and .NET use 'T', Moment uses [T], PHP uses \T and PostgreSQL uses "T". Python and MySQL print letters as they are, and need %% for a percent sign.
Does JavaScript's Intl.DateTimeFormat use these codes?
No. Intl.DateTimeFormat takes options such as { year: 'numeric', month: 'long' } and orders them by locale. Use date-fns or Day.js when you need an exact pattern.
Why are some codes missing for a language?
Not every language can print every field. Those gaps are listed under each table, and the Date Pattern Tester shows them when you translate a pattern.
Tutorials
How to format dates in MySQL with DATE_FORMAT
Write MySQL DATE_FORMAT patterns for day-first dates, month names and ISO timestamps, and avoid the %M and %i mix-up.
How to format dates in Python with strftime
Use the strftime cheat sheet to build Python date formats for ISO 8601, day-first dates, month names and 12-hour times, with examples for each code.