← Cheat Sheets

strftime Date Format Codes

Format codes shared by C, Python, PHP and many other languages.

# strftime Date Format Codes

Format codes shared by C, Python, PHP and many other languages.

| Code | Meaning | Example |
|---|---|---|
| %Y | Year, 4 digits | 2025 |
| %y | Year, 2 digits | 25 |
| %m | Month number | 03 |
| %B | Month name | March |
| %b | Month abbreviation | Mar |
| %d | Day of month | 07 |
| %A | Weekday name | Friday |
| %a | Weekday abbreviation | Fri |
| %H | Hour 00-23 | 14 |
| %I | Hour 01-12 | 02 |
| %p | AM or PM | PM |
| %M | Minute | 05 |
| %S | Second | 09 |
| %j | Day of year | 066 |

Some languages (like PHP's `date()` or JavaScript's `Intl`) use different codes.