Automatically Update Copyright Year on a Website (For Dummies)

It may seem like a trivial thing to some, but many web designers, novices, and bloggers don't know how to have the copyright year automatically update on their website.

It's true that the year should really only be updated when the content has been updated, but for small business that don't get around to updating their content much. An ancient copyright year can look bad to prospective customers.

To show the current year, just use the following PHP code snippet.

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

The full thing (assuming the current year is 2010)

<p>&copy; 2001-<?php echo date("Y"); ?> Company Name</p>

© 2001-2010 Company Name

For more information see the PHP documentation about the date function.

 

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <b> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <br> <blockquote> <align> <p> <h1> <h2> <h3> <h4> <object> <param> <embed>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Twitter-style @usersnames are linked to their Twitter account pages.
I love Drupal! drupal-love-right.png