Willy Nelson Willy Nelson - 1 year ago 143
Python Question

How to display the current year in a Django template?

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

Answer Source

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