Fix Python – How to display the current year in a Django template?

Question

Asked By – Willy Nelson

What is the inbuilt template tag to display the present year dynamically. Like “2011” what would be the template tag to display that?

Now we will see solution for issue: How to display the current year in a Django template?


Answer

The full tag to print just the current year is {% now "Y" %}. Note that the Y must be in quotes.

This question is answered By – Haldean Brown

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0