Django template datetime.weekday name

Is there a way to show the day of the week of the datetime object in the template as the actual name of the day of the week? Mostly I want it to print Fridayinstead 5.

+5
source share
3 answers

See the documentation for the built-in filterdate . From there you will see what you need to use:

l Day of the week, text, long. 'Friday'

+11
source

You can also use:

import datetime
today = datetime.datetime.today()
print(today.strftime('%A'))
+4
source

For clarity, the tag template template "l" (lowercase "L") can be used in a Django template, for example:

{{ object.some_date_field | date:"l" }}

Django 1.8.2

+3
source

All Articles