Here's how to change your footer date automatically

Hey all :wave:

There are lots of sites that use footers like this:

Copyright © 2012 - 2018 www.mywebsite.com

There is an easy way to have your site update the date each year without having to manually change them. Just add this code to your footer, and it’s done saving you at least 30 seconds each year. That’s… over 2 seconds per month! :exploding_head:

Image result for maths gif

Copy the code below to your clipboard, and paste into a HTML embed on your site footer, or wherever else you may like it.

Copyright &copy; 2000<script>new Date().getFullYear()>2015&&document.write("-"+new Date().getFullYear());</script>, ENTER YOUR COMPANY DETAILS HERE

Where Copyright &copy 2000 is used, this gives you Copyright © 2000 If you don’t want the starting year, then just remove it.

Copy the full line above, open a HTML embed on your page, and copy the code in. Edit what you like (you can always use notepad to edit first.

You will see the code on your published site, you can change the fonts by styling the parent div, or the actual html embed itself.

You can now spend that 30 seconds per year looking at websites that have 2018 still on them and shaking your head with disdain. Enjoy.

Image result for head shake gif

10 Likes

Thanks for sharing :webflow_heart:

Genuinely appreciate this tip. Lol!

1 Like

Awesome! Super helpful thanks :slight_smile:

Unfortunately, using this method will generate warnings.

https://web.dev/no-document-write/

I’ve taken to using this method, which generates no warnings.

&copy;
    <span id="copyright">
        <script>document.getElementById('copyright').appendChild(document.createTextNode(new Date().getFullYear()))</script>
    </span>
  Company Name
1 Like

Thanks that worked really well!