Recently, I was reading an article on Smashing Magazine called…”Don’t Forget The Small Stuff This Year“, and within that article it reminded users to update their copyright statement each new year!
Have you ever forgotten to update your copyright statement to 2010? I know I have, however; let’s make sure that doesn’t happen again. With this short PHP code snippet, your statement will automatically update! How cool is that?
<p><strong>&copy; Copyright 2010 <a href="/">The Web Squeeze, LLC.</a> All Rights Reserved.</strong></p>
We’re going to change the above to…
<p><strong>&copy; Copyright <?php echo date('Y'); ?> <a href="/">The Web Squeeze, LLC.</a> All Rights Reserved.</strong></p>
The key in the above code is this line…
<?php echo date('Y'); ?>
The above line of code is using PHP’s built in date function. We’re saying echo out the current year (Y) in a 4 digit format. (e.g. 2010) If you’ve never used the date function, or want to customize the above a bit further, check out the date function.
http://us2.php.net/manual/en/function.date.php
I hope this helps make your life just a tad easier!




















Comments
I bet you are Jacob!
You have just reminded me to change them. I did read the same article in Smashing Magazine but somehow I did not think about it, silly me ^_^
Great tip! I always do this for designs since it would be a hassle to have to find each site I ever built each year, just to update that little number.
PHP saves the day, once again!
Nice little tip, Jacob
I believe technically copyright dates should be a range if they span more than one year (which they will if you’re changing the date).
So really, your code should be more like:
<p><strong>© Copyright 2008 – <?php echo date(‘Y’); ?> <a href=”/”>The Web Squeeze, LLC.</a> All Rights Reserved.</strong></p>
Or something similar
I saw people do like that. What is the different between that two?
Which is the best or should I say, which one should we use?
I wasn’t aware of this tip but this would certainly come in handy. I’m going to implement this on my client sites. I use a span of years in copyrights so Japh’s code will work well for the majority. However when I develop a brand new site for a new business, Jacob’s will work for the first year!
Thanks!
I wasn’t aware of this tip but this would certainly come in handy. I’m going to implement this on my client sites. I use a span of years in copyrights so Japh’s code will work well for the majority. However when I develop a brand new site for a new business, Jacob’s will work for the first year!
Thanks!
Hmm… so longer-lasting code then, so you can use it on new projects too!
<p><strong>© Copyright <?php $year=’2008′; echo (date(‘Y’) == $year ? $year : $year.’ – ‘.date(‘Y’)); ?> <a href=”/”>The Web Squeeze, LLC.</a> All Rights Reserved.</strong></p>
I believe, from what I’ve read, that using a Copyright deceleration at the bottom of your website doesn’t matter. Anything you publish to the internet is copyright of the website, regardless of whether you have this deceleration or not. A Copyright deceleration, however, is useful if you are displaying another person’s work on your website.
Disclaimer:
Please remember, that in no way am I an IP (Intellectual Property) lawyer. Thus, accept no liability for the above statement.
@Japh @Linda
It’s all a matter of personal preference which you use. It’s not required to use a range, however, some prefer that.
@Marc
That’s a good point Marc!