Last updated 17 March 2014. Created on 21 December 2012.
Edited by Matt V., lolandese, philsward. Log in to edit this page.

Tired of updating a whole bunch of site footers after New Year passed? There are several ways of accomplishing this and it's easier than you might think!

The PHP Way

This snippet always displays the current year in the copyright line.

For example:

&copy; <?php 
$startYear = 2010; 
$curYear = date('Y'); 
echo $startYear . (($startYear != $curYear) ? '-' . $curYear : '');

Results in:
© 2010-2013

If in a new website the current year is still the start year ($startYear = 2013), only one will be displayed. For example:
© 2013

*Note: This method is not recommended if you plan to use it in the "PHP" input filter. Using the PHP input filter is a deprecated method for several reasons: first, using the PHP input filter is not secure and second, Drupal won't cache areas of the site that use the PHP filter. In fact, Drupal 8 no longer has the PHP filter module as a core option.

The Contrib Module Way

Both the PageRank Widget and Uptime Widget module have this functionality added as a bonus option. This is a great alternative for those who want a quick and easy way of getting the copyright year into their footer without having to worry about updating it.

The Token Filter Way

Last but not least, another method is to install the Token Filter module. This will allow you to expose all of the site-wide tokens at the input filter level (Full HTML filter for example), using the [date:custom:Y] token for the current year. For the start year, simply add it as a static year.

Example 1:

Copyright © 2005-[date:custom:Y]

Result: Copyright © 2005-2013

Example 2:

Copyright © 2005-[date:custom:Y] | <a href="[site:url]" title="[site:name] Home Page">[site:name]</a>

Result: Copyright © 2005-2013 |

List of built-in tokens for Drupal 7

The benefit to this method is the flexibility it gives when constructing the footer copyright. The easiest way to do this is by creating a new block and adding it to the text area, then switch the input filter over to the one that has token filter enabled.

If you use this method, make sure you only allow trusted people access to the token input filter.

Looking for support? Visit the forums, or join #drupal-support in IRC.