loading...

Dynamically Set Footer Copyright Date

chrisotto profile image Chris Otto Originally published at chrisotto.dev on ・1 min read

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>

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

Discussion

markdown guide