A simple way to have javascript show the date.

<script>document.write(new Date().getFullYear())</script>

This prints a nice round year, as such: 2017

I am not a Javascript developer, but I’m a good Googler. Many times I’ve come across the question of how to echo date without the use of a dynamic language like PHP. And if you’re building a static site like this site (built with Hugo, a static site generator), using PHP may be out of the question. This is where I’ve come to Google my way to a happy ending. The above Javascript snippet seems to successfully show the year (great for copyrights) without error across lots of browsers and lots of devices.

A downside is that you are relying you the browsing machine’s clock to tell you the date. Should that computer have an incorrect year on its clock on it, so will the pages it browses using this method. I consider it a low risk for my use of it – showing the year for copyright purposes often in the footer of a site.