Use PHP to keep the date fresh on your site

Posted by ljmacphee on February 4, 2008 under how to |

I was reading an article reminding webmasters to update the copyright date on their webpages and someone added a note about how to have PHP automatically do this for you.

To show the day of the week:

<?php echo date(”D”) ?>

To show the day of the month:

<?php echo date(”d”) ?>

To show the month:

<?php echo date(”M”) ?>

To show the year:

<?php echo date(”Y”) ?>

That is the code used in the footer at the bottom of the page to show the copyright year.

Add A Comment

You must be logged in to post a comment.