Blogtastic!
The firegrid Blog. Thoughts, humour, ranting and general randomness. Wowzers!

Categories

Show all  (123 Posts)
Design and Graphics  (4 Posts)
Gaming  (24 Posts)
Humour  (18 Posts)
Internet and Technology  (16 Posts)
Personal  (14 Posts)
Random Stuff  (18 Posts)
Website News  (29 Posts)
Fri 8th May 2009

Using PHP date in your footer


Filed under: Internet and Technology

If you have your own website then the chances are you have a footer containing a copyright notice and a date.

While this is all fine and dandy in itself, when was the last time you checked the date?  Even if you often update your website it's very often something that gets overlooked.

While this isn't a problem in itself, it does a look a little bad when in the year 2009 your copyright notice is stating 2004 for example.

You could of course put a note in your diary to change the date on your website on the 1st of January every year but having it done automatically is going to be the best option.

So, how do you achieve this?  Simple!  By using PHP.  Simply stick the following code in your PHP enabled page:

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

This will print out the current year - every year it updates automatically.  Hoorah!

Check out the official PHP Date page at php.net for more information and further usage examples.
 
Comments

There are currently no comments for this article.
Add a comment to this article
Name
Email Address (Not Published)
Website (Optional)
Comments
Verification