Here is a list of common format codes for datetime. For a complete list visit: Python strftime documentation
Datetime Formatting Codes
| Code | Meaning | Example |
|---|---|---|
| %a | Weekday as locale’s abbreviated name. | Mon, Tue,.. |
| %A | Weekday as locale’s full name. | Monday, Tuesday,.. |
| %d | Day of the month as a zero-padded decimal number. | 30 |
| %b | Month as locale’s abbreviated name. | Jan, Feb |
| %B | Month as locale’s full name. | January, February,.. |
| %m | Month as a zero-padded decimal number. | 09 |
| %y | Two digit year as a zero-padded decimal number. | 19 |
| %Y | Four digit year as a decimal number. | 19 |
| %H | Hour (24-hour clock) as a zero-padded decimal number. | 07 |
| %I | Hour (12-hour clock) as a zero-padded decimal number. | 07 |
| %p | Locale’s equivalent of either AM or PM. | AM |
| %M | Minute as a zero-padded decimal number. | 06 |
| %S | Second as a zero-padded decimal number. | 05 |
