Is it still copyright 2007? If so, this is your friendly reminder to change it. Better yet, why not use a little bit of code that does it for you?
1 2 3 4 5 6 7 | Copyright © <?php // automatically update the copyright date each year ini_set('date.timezone', 'America/New_York'); $startYear = 2000; $thisYear = date('Y'); echo "{$startYear} - {$thisYear}"; ?> all rights reserved |
You can get a list of timezones from the PHP manual.
4 People Have Bloviated
Dave Bowker | Jan 14
That’s a little bloated for displaying the year. I’ve used a similar effect on all my sites…
<?php echo date(‘Y’); ?>
Jen | Jan 14
Dave-Thanks for providing another way to do this. There are so many different methods for automating the date, I should have probably posted a few more.
Ian Ferguson | Jan 18
Hey there! I realize that the supplied code snippet was meant to provide date ranges greater than $startYear; however, I think it’s still wise to account for $startYear being equal to $thisYear (2008–2008) — which would be redundant — as well as protect against any technical issues resolving the server’s timestamp (eg. 2008–1950).
< ?phpini_set('date.timezone','America/New_York');echo (($thisYear=date('Y'))>($startYear=2000))?$startYear."–".$thisYear:$startYear;?>Jen | Jan 19
Thanks for the tip, a much smarter way to handle it. I’m no PHP coding expert so sometimes I end up taking the long way around.