A zero-dependency JavaScript library for handling date-time string formatting the PHP way.
Created by Warren Uhrich.category | character | description |
---|---|---|
year | Y | four-digit year number |
y | two-digit year number | |
L | 1 if a leap year, 0 if not | |
month | m | month number (with leading zero) |
n | month number (without leading zero) | |
F | full textual name of the month | |
M | three-letter textual name of the month | |
t | number of days in the month | |
day | d | day of month (with leading zero) |
j | day of month (without leading zero) | |
l | full textual day of the week | |
D | three-letter textual day of the week | |
hour | h | 12-hour clock hour (with leading zero) |
g | 12-hour clock hour (without leading zero) | |
a | lower-case am or pm | |
A | upper-case am or pm | |
H | 24-hour clock hour (with leading zero) | |
G | 24-hour clock hour (without leading zero) | |
I | 1 if in daylight savings time, 0 if not | |
minute | i | minutes (with leading zero) |
second | s | seconds (with leading zero) |
u | microseconds | |
U | number of seconds since the Unix Epoch | |
other | N | numeric day of the week (1=Monday, 7=Sunday) |
w | numeric day of the week (0=Sunday, 6=Saturday) | |
S | suffix for the day of the month (st, nd, rd, th) | |
z | numeric day of the year (0-365) | |
W | ISO-8601 week number of the year (weeks starting with Monday) | |
o | ISO-8601 year number | |
b | Swatch Internet time (000-999) | |
e | timezone identifier | |
O | difference to Greenwich Time (GMT) in hours (+0000) | |
T | timezone abbreviation (EST) | |
Z | difference to Greenwich Time (GMT) in seconds (negative if west of UTC) | |
c | ISO-8601 date (1982-07-09T05:00:00+00:00) | |
r | RFC 2822 date (Fri, 09 Jul 1982 05:00:00 +0000) |