Appendix C. Formatting Dates and Times
This appendix is a quick reference for when you format dates and times in your Django templates. The following tables list the format characters that are available for the now tag and the date and time filters. Table C.1 describes the available format characters for formatting dates. Table C.2 describes the available options for formatting times.
Table C.1. Date Format Characters Available for datetime Objects
Character | Description | Example |
|---|---|---|
b | Month, textual, three letters, lowercase. | jan |
d | Day of the month, two digits with leading 0s. | 01 to 31 |
D | Day of the week, textual, three letters. | Mon to Sun |
F | Month, textual, long. | January |
j | Day of the month without leading 0s. | 1 to 31 |
l | Day of the week, textual, long. | Monday |
L | Boolean for whether ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access