Code to automatically update the copyright date in your footer

I was looking for this information the other day and it took me quite a few goes before I found the solution that worked so I have put it on my blog to help you so that you can have the correct code that works!

The Problem

If you use wrodpress then you will see that at the bottom there is a copyright date like this one on my website:

copyright date

It automatically updates each year which is great.

However, sometimes you might create an html web page and then you have to type the copyright date at the bottom. It doesn’t get updated so you have to rememebr to change it each year.

How annoying is that!

So I wanted to find out what the code was so that it would update automatically.

The Solution

After a lot of searching and trying various codes I found one that works. Here it is:

<script type="text/javascript">
var d = new Date()
document.write(d.getFullYear())
</script>

Put that code next to “Copyright” and the date will automatically update each year for you.

Leave a Reply

Your email address will not be published.