Automatically Update Your Copyright Date
It's the year 2010 now, and just like how you may need a new calendar, you've probably gone and updated the copyright date in your site's footer. It's one of the more boring parts of website maintenance that we all have to deal with.
But if you're using PHP, you can avoid this little bit of extra work with a simple little PHP one-liner. Some might already know this, but it can be useful for beginners.
<?php echo date('Y'); ?>
This one-liner calls the PHP date function. This function does exactly what you'd think: it gets the current date. It accepts certain parameters, for formatting the date. Here we used 'Y', which displays the date as a four-digit year.
Because the date function simply returns the date, and does not actually display, it, we just use
echo to show it in the page.
So with this snippet, your footer copyright notice could look something like this:
<p class="copyright">Copyright © <?php echo date('Y'); ?> <a href="http://fwebde.com/">FWebDe</a>.</p>
Of course, this does not only need to be for copyright notices. This can be used in any situation where you need to use the current date, along with time.