PHP date() tokens.

DateTime::format(), Carbon

Every token is a single bare letter, so case is the whole vocabulary: m and M, h and H, and the easily confused l (weekday name) versus L (leap year) mean different things. Names always render in English — like Go, there is no locale support here. The famous trap is z, the day of year: it starts from 0, so January 1 is day 0 and it runs one behind every other language's day-of-year; it is deliberately left unmapped below. Sub-second tokens (v, u) only produce real digits from a DateTime object — date() itself takes an integer timestamp and always prints zeros. No era or quarter tokens; BCE years just get a minus sign from Y.

TokenMeansExample
YFour-digit year

At least four digits; years BCE get a leading minus sign.

2006
yTwo-digit year06
nMonth number1
mMonth number, padded01
MMonth name, abbreviatedJan
FMonth name, fullJanuary
jDay of month2
dDay of month, padded02
DWeekday, abbreviatedMon
lWeekday, full

Lowercase L. For numeric weekdays, N gives ISO 1 (Monday) to 7 and w gives 0 (Sunday) to 6.

Monday
WWeek of year

ISO-8601 week, Monday start, zero-padded to two digits (the manual's example 42 hides the padding). Pairs with o, not Y.

1
oISO week-based year

Same as Y except around New Year, when the ISO week belongs to the neighbouring year.

2006
GHour, 24-hour clock15
HHour, 24-hour clock, padded15
gHour, 12-hour clock3
hHour, 12-hour clock, padded03
AAM/PM marker

Uppercase AM/PM; lowercase a gives am/pm.

PM
iMinute, padded04
sSecond, padded05
vFractional seconds

Exactly three digits (milliseconds); u gives six (microseconds). Real digits require a DateTime object — date() always prints zeros.

000
OUTC offset, basic-0700
PUTC offset, extended

p (PHP 8.0+) is identical but prints Z instead of +00:00.

-07:00
TTime-zone name, short

Falls back to a GMT offset like +05 when no abbreviation is known; e gives the full identifier (Atlantic/Azores).

MST
UUnix timestamp1136239445

Examples render the reference instant, Mon, Jan 2 2006, 3:04:05 PM MST.

Literal text

Escape a recognized letter with a preceding backslash, e.g. \j. Inside double-quoted PHP strings the backslash itself may need doubling ("\\t") because \t is already an escape sequence — single-quoted format strings avoid the problem.

Verified against PHP manual — DateTimeInterface::format() format characters.

Translate PHP date()