Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django template datetime.weekday name

Is there a way to display the weekday of a datetime object in a template as the actual name of the weekday? Basically I want it to print Friday instead of 5.

like image 954
Squazic Avatar asked May 04 '12 20:05

Squazic


2 Answers

See the documentation for the built-in date filter. From there you'll see you need to use:

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

like image 192
Burhan Khalid Avatar answered Nov 15 '22 19:11

Burhan Khalid


For clarity's sake, the template tag format character "l" (lower-case "L") can be used in the Django template like so:

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

Django 1.8.2

like image 24
modle13 Avatar answered Nov 15 '22 20:11

modle13