Updated June 29, 2026
Date format tokens reference
Different ecosystems use different format tokens to turn a date into a string. This sheet covers the classic strftime tokens and the Unicode (LDML) tokens used by JavaScript libraries like date-fns and Day.js.
strftime (Python, C, PHP, Ruby)
Examples shown for 2026-06-29, 14:05.
| Token | Means | Example |
|---|---|---|
%Y | Four-digit year. | 2026 |
%y | Two-digit year. | 26 |
%m | Month, zero-padded. | 06 |
%d | Day of month, zero-padded. | 29 |
%H | Hour, 24-hour. | 14 |
%I | Hour, 12-hour. | 02 |
%M | Minute. | 05 |
%S | Second. | 00 |
%p | AM or PM. | PM |
%A | Full weekday name. | Monday |
%B | Full month name. | June |
%j | Day of the year. | 180 |
%z | UTC offset. | +0000 |
Unicode tokens (date-fns, Day.js)
Used by many JavaScript date libraries.
| Token | Means |
|---|---|
yyyy | Four-digit year. |
MM | Month, zero-padded. |
MMMM | Full month name. |
dd | Day of month, zero-padded. |
EEEE | Full weekday name. |
HH | Hour, 24-hour. |
hh | Hour, 12-hour. |
mm | Minute. |
ss | Second. |
a | AM or PM. |
JavaScript's built-in Date is differentNative
Intl.DateTimeFormat uses an options object, not format tokens. The Unicode tokens above apply to libraries like date-fns and Day.js, not the built-in Date.toLocaleString.References
Questions
Why does %m mean month but mm sometimes mean minutes?
They are different systems. In strftime, %m is month and %M is minute. In Unicode tokens, MM is month and mm is minute, with case carrying the meaning.
Can I use strftime tokens in JavaScript?
Not with the built-in Date. Native formatting uses Intl options. To use tokens like yyyy-MM-dd in JavaScript, use a library such as date-fns or Day.js.