December 27, 200619 yr Hi all As you all know I'm no PHP expert, so I'm posting this thread to find out if it is possible to set the year dynamically using PHP. In the footer of most of the sites that I create I have a copyright statement which states the year - all currently set to 2006. When 2007 comes along I'm going to have to go into all the sites and update that to 2007 and just wondered if there was a PHP script I could put in place of the year that would check what year it is and then display it to save me having to go in and do this manually. E
December 27, 200619 yr Author how do you do that then? and what happens if someone has javascript switched off?
January 7, 200719 yr how do you do that then? and what happens if someone has javascript switched off? Try this <?php echo "%Y"; ?>
January 7, 200719 yr Ah, you you need to use the php date function... See below. <?php // Prints something like: Monday 06th of January 2007 03:12:46 PM echo date('l dS \of F Y h:i:s A'); ?> More information about setting the date can be found here. Link: http://uk2.php.net/date
January 7, 200719 yr Author Ben you genius...thanks ever som much! Dave was pretty close though...just changed what he suggested to: <?php echo date('Y'); ?> And it works! Fab.
Create an account or sign in to comment