How to display the current year in a Django template?

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


{% now 'Y' %} is the correct syntax


{% now %}


I have used the following in my Django based website http://pmtboyshostelraipur.pythonanywhere.com/ which works fine as expected (Maybe, by the time you're reading this post, it would have stopped working because that's a free hosting so just try in code and see).

{% now 'Y' %}

You can visit & see it in the footer part where I have displayed the current year using the below code(CSS part is omitted so use your own).

<footer class="container-fluid" id="footer">
    <center>
        <p>
           &copy;
           {% now 'Y' %}, 
           PMT Boys hostel <br> 
           All rights reserved
        </p>
    </center>
</footer>

And it is displaying the following centred text in my website's footer.

©2018, PMT Boys hostel 
All rights reserved