Hamed Salimian
Hamed Salimian

Reputation: 881

How get date format in Django template

I am new to django. In my template I need the current date as date format, while the following code returns string:

<p>{% now "Y-m-d" as date %}</p>

where I want the date in format of 2018-12-17 as a date not string. Is there anyway to do that?

thnaks

Upvotes: 7

Views: 16427

Answers (1)

Alpha0scar
Alpha0scar

Reputation: 300

You can use filters built into django

{{ value|date:"D d M Y" }}

find more here

Upvotes: 15

Related Questions