PHP Quicky - Always show the correct copyright date

0 replies
Here's an easy PHP one-liner that will save the day when it comes to displaying the CURRENT year in a website's copyright footer.

Ever visit a website and notice the footer displaying "Copyright 2006 xyz.com bla bla bla"

adding this PHP line will display the current year, always. It's totally automatic.

relace '2006' with:

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

Taking this further is easy. Any where yo u need to display date time information, the PHP 'date()' statement is your friend.

examples:

"from the desk of Mr. Big, January 12, 2011 12:34:56"

the date /time part can be automated using this PHP one liner:

<?php echo date("F j, Y H:i:s"); ?> and voila, instant real-time date/time displayed.


This was an easy one I'm sure you all knew about. More to come later.

Please, if you have any suggestions, pm me, I'll add them to this forum.

Cheers,
WP4H
#copyright #correct #date #php #php help #quicky #show

Trending Topics