docs.paste.lol / weblog-time-formatting.md · 1 year ago·

Datetime Format

Day Format Value/Example
d 01 through 31
D Mon through Sun
j 1 through 31
l (lowercase 'L') Sunday throguh Saturday
N 1 (Monday) to 7 (Sunday)
S st, nd, rd, th
w 0 (sunday) through 6 (Saturday)
z 0 through 365
Week Format Value/Example
W 42 (42nd week in year)
Month Format Value/Example
F January through December
m 01 through 12
M Jan through Dec
n 1 through 12
t 28 through 31
Year Format Value/Example
L 1 (leap year), 0 otherwise
o same as Y, except that it use week number to decide which year it falls onto
Y 1991, 2012, 2014, ...
y 91, 12, 14, ...
Time Format Value/Example
a am or pm
A AM or PM
B 000 through 999
g 1 through 12
G 0 through 23
h 01 through 12
H 01 through 23
i 00 throguh 59
u 123456 (microseconds)
Timezone Format Value/Example
e UTC, GMT, Atlantic/Azores
I (capital i) 1 (daylight), 0 otherwise
O +0200
P +02:00
T EST, MDT, ...
Z -43200 through 50400 (timezone offset)
Date/Time Format Value/Example
c 2004-02-12T15:19:21+00:00
r Thu, 21 Dec 2000 16:01:07 +0200
U seconds since Jan 1 1970 00:00:00 GMT