Happy echo date(‘Y’)

It’s at times like these that I am very happy I declare copyright notices on the sites I manage using the php method for echoing the year.

Copyright © <!--?php echo date('Y'); ?-->

Saves a lot of time and panic after noticing a site you built years ago looks somewhat out of date.

Update: via Maarten Jacobs (@MaartenJJ) it’s a good idea to set the timezone to ensure it displays correctly for the users location via date_default_ timezone_set(). Thanks Maarten

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>