Automatically Update Your Copyright Date


It's the year 2010 now, and just like how you may need a new calendar, you've probably gone and updated the copyright date in your site's footer. It's one of the more boring parts of website maintenance that we all have to deal with.

But if you're using PHP, you can avoid this little bit of extra work with a simple little PHP one-liner. Some might already know this, but it can be useful for beginners.

<?php echo date('Y'); ?>

This one-liner calls the PHP date function. This function does exactly what you'd think: it gets the current date. It accepts certain parameters, for formatting the date. Here we used 'Y', which displays the date as a four-digit year.

Because the date function simply returns the date, and does not actually display, it, we just use echo to show it in the page.

So with this snippet, your footer copyright notice could look something like this:

<p class="copyright">Copyright &copy; <?php echo date('Y'); ?> <a href="">FWebDe</a>.</p>

Of course, this does not only need to be for copyright notices. This can be used in any situation where you need to use the current date, along with time.

Stay Updated

Did you enjoy this post? Don't miss a single post by getting free updates!


  1. January 2, 2010

    I did`nt even think about mine until i read this post. All done now thanks.

  2. January 3, 2010

    Hi Eric!

    Thanks for the reminder that I gotta do this on my site.

  3. January 27, 2010

    I was trying to remember off hand how to do this because I was manually updating a lot of my site footers recently. (Wonder wy? lol)

    Thanks for the reminder and snippet!

  4. October 6, 2010

    This is wonderful! Thank you for sharing this with all of us, it will save me a lot of time! I can't tell you how often I'll wrap up a major update only to have to go back and do the copyright date.

  5. January 8, 2012

    I've written a short snippet which is an improvement over this, as it supports date ranges, so all you enter is the start date, and then it will display it as just that year, or that year to the current one if applicable

    Check it out at