Snippets

Auto Update The Year In Footer Copyright Message

I used to have to update these manually for my clients so did a bit of digging and found a few different tutorials that helped me slap this together. Now the year in the copyright message always displays the current year.

<?php 
 		$time = time () ; 
 		//This line gets the current time off the server

 		$year= date("Y",$time); 
 		//This line formats it to display just the year

 		echo "Copyright &copy;" . $year . " YOUR-SITE-NAME | All Rights Reserved";
 		//this line prints out the copyright date range
 ?>

Share this snippet

 
  • http://tonyvirelli.com Tony Virelli

    This works just as well with less code:

  • sjc

    you could just use

    Copyright © YOUR-SITE-NAME | All Rights Reserved

  • Christophor S. Wilson

    Or you could even just do:

    echo “Copyright © ” . date(‘Y’) . ” YOUR-SITE-NAME | All Rights Reserved”;

    That’s how I like to roll!