So it’s 2011
Careful! This post is looking a little old and could be inaccurate in many, many ways
Yesterday I saw a few tweets from people remarking how they will have to change their footers copyright statement from 2010 to 2011, given those who were tweeting about it I was surprised that they hadn’t previously been implementing a more dynamic solution. These are supposedly experts in our field.
Luckily a few other bright sparks quickly suggested a solution that is certainly much better than having to change hundreds of sites each year.
1 |
<?php echo date('Y') ?> |
The above simply outputs the year in a four digit format. Simples.
Sometimes I do question the necessity of the copyright statement at all, it does little in enforcing copyright as this is implied without the need to state it. However it’s something to put in the footer and can put the clients mind at rest with its inclusion. So while it’s there we may as well have something a little more intelligent.
1 2 |
<?php $launch = "2011"; ?> <?php if(date('Y')== $launch){ echo $launch; }else{ echo $launch ." - ".date('Y'); }?> |
What the code above does is show the current year if we’re in the year of launch or show both the launch year and current year if not.
It’s partially personal preference that I do things this way but it also helps establish the age of a website. Should the code remain through what would likely be numerous redesigns you could eventually be displaying ‘2011-2111’, clearly showing a site and company with some heritage.
Feel free to give either examples above a go, but in the meantime Happy New Year.