DEV Community

Chris Otto
Chris Otto

Posted on • Originally published at chrisotto.dev on

Dynamically Set Footer Copyright Date

With 2018 winding down I found myself thinking that I will need to leave a note to update the footer on my site to change the year to 2019. Having to come back year after year to statically change the copyright year in my footer is something I will no longer do. So why not have it set dynamically?

<script>
  document.write(new Date().getFullYear())
</script>
Enter fullscreen mode Exit fullscreen mode

Instead of just adding the year I also included a copyright character and my name wrapping the new script.

©
<script>
  document.write(new Date().getFullYear())
</script>
Chris Otto
Enter fullscreen mode Exit fullscreen mode

Top comments (0)