January 01, 2020 by Kostas Vrouvas

It is 2020. Set your footer year to change automatically

It’s 2020 already, and now is the time to update your static timestamp to an automatically updating copyright year or other dynamic timestamp.

If you are using WordPress

If you are using WordPress as your CMS, you can add this snippet in your footer.php to add the current year:

© <?php echo date("Y"); ?>

Or if you want to showcase more than the current year, such as the name of your WordPress site, you can add this snippet:

© <?php echo date("Y"); ?> - <?php bloginfo('name')?>

Here, we use <?php bloginfo(‘name’)?> to get the name of our WordPress website.

For PHP projects

If you are working on a PHP project, you can use this one:

© <?php
  $fromYear = 2008; 
  $thisYear = (int)date('Y'); 
  echo $fromYear . (($fromYear != $thisYear) ? '-' . $thisYear : '');?> Company.

For Javascript projects

Here’s a snippet you can customize yourself using JavaScript:

&copy; 2010<script>new Date().getFullYear()>2010&&document.write("-"+new Date().getFullYear());</script>, Company.


To make sure that your footer is always updated, it’s better to just let computers take care of this. Grab one of these snippets and paste that on your page!

© 2020 Kostas Vrouvas, Built with Gatsby