How do I display the current year?


Trying to put the current year in the footer of my theme. Is there a way i can dynamically add that?


Ok I figured it out it’s {{ .Now.Year }}


Getting year for a post date variable you can do:

{{ .Date.Format "2006" }}


Current year for footer:

{{ .Now.Format "2006" }}


I’ve been using .Now.Year but told it is deprecated and to use the now template function. How do you use it? Its not documented and can’t seem to find a forum post about using it. Not on or the netlify version of site.

The reason I ask is because I can’t .Now.Year in my custom RSS but can do it in a partial.


Display the current year using the template function dateFormat:

{{ dateFormat "2006" now }}


Also work {{ now.Year }}


{{ now.Format “2006” }} is what ultimately worked for me.


I’ve got the latest version of Hugo (0.29) and I can’t get the year to work.


Both of the below work for me on version 0.30-DEV.

{{ now.Format "2006" }}


{{ dateFormat "2006" now }}

It might help if you can upload your example site somewhere (github, gitlab) and paste a link to that.