Insert current year using PHP

Ever remembered in June that you forgot to update the copyright notice in your footer for the new year? Want an easy way to always have the current year? Try this little snippet of PHP code.

PHP:
  1. <?php echo date(“Y”); ?>

This will output the current year in 4 digits. Let’s say you currently have a copyright notice in your footer that says “Copyright 2004 by Bob Smith Photography” and you want it to always include the current year. Look for the copyright notice and insert the PHP code, or just copy what’s below as your copyright notice.

PHP:
  1. Copyright 2004-<?php echo date(“Y”); ?> by Bob Smith Photography

Question, Comments...

Do you have more questions. Please either leave a comment below or join us in our new forum.

Leave a Reply