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

djangopython

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

Best Answer

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