O'Reilly

Dear Developers, Don’t Hardcode Copyright Years

By on  

Keeping your website current is extremely important when your goal is increasing return traffic. One easy place to make your website look current is in the copyright text at the bottom of the page. This is a rather obvious and easy thing to do, but some sites have overlooked their copyright year.

Offender 1: Google Analytics

Offender 2: Cedant Web Hosting

Offender 3: VH1

Offender 4: Kraft Foods

Offender 5: MooTools

Offender 6: Manning Publications

Offender 7: Prototype JS

Offender 8: Rock Band

The moral of the story? Don't hardcode your site's copyright year unless you must legally keep a specific year.

Track.js Error Reporting

Upcoming Events

Recent Features

  • CSS vs. JS Animation: Which is Faster?

    How is it possible that JavaScript-based animation has secretly always been as fast — or faster — than CSS transitions? And, how is it possible that Adobe and Google consistently release media-rich mobile sites that rival the performance of native apps? This article serves as a point-by-point...

  • 5 HTML5 APIs You Didn’t Know Existed

    When you say or read "HTML5", you half expect exotic dancers and unicorns to walk into the room to the tune of "I'm Sexy and I Know It."  Can you blame us though?  We watched the fundamental APIs stagnate for so long that a basic feature...

Incredible Demos

  • CSS 3D Folding Animation

    Google Plus provides loads of inspiration for front-end developers, especially when it comes to the CSS and JavaScript wonders they create. Last year I duplicated their incredible PhotoStack effect with both MooTools and pure CSS; this time I'm going to duplicate...

  • Instagram For MooTools

    If you're still rocking an iPhone and fancy taking a photo every now and then, you'd be crazy not to be using an app called Instagram.  With Instagram you take the photos just as you would with your native iPhone camera app, but Instagram...

Discussion

  1. From one of my templates:

    Looks a bit ugly but does the trick just fine. ;)

  2. That should have been:

    print(gmdate('Y')!='2005'?'2005-'.gmdate('Y'):gmdate('Y'));
    

    (I hope it works now… a preview button would have been nice by the way.)

  3. Jos: Absolutely. Here’s what I use for this site:

    echo date('Y') == '2007' ? '2007' : '2007 - '.date('Y');
    

    Obviously I hardcode 2007 because that’s the year the blog started.

  4. I always would notice that Google would change their copyrights on the day of new years. I was always impressed that they were on top of it.

    Later I realized that they just pull it from the date on the server. From then on I have always done it that way. I am suprised that you found so many sites that are out of date.

  5. bekee

    the need for copyright is only necessary when there’s new content on the site… so if they haven’t made changes in 2008, there’s no need to copyright it for this year until new content appears.

    i’m just sayin’. i use server-side though. :)

    var d = new Date(); document.write(d.getFullYear());

  6. I use PHP to echo whatever the current year is – so my copyright updates at midnight on New Year :)

  7. Hey guys Just do:

    and thats it.

  8. Hey guys Just do: echo date("Y"); and thats it.

  9. Martyn P

    I’m never sure of what sort of rules there are on this sort of thing. If anyone could point me to a nice resource on website copyrights it would be much appreciated. :)

  10. I also look at copyright notices to check how “fresh” a Web site is, so I basically agree with this post. However, it’s important to keep in mind that changing the copyright date at the bottom of each page on your site really has nothing to do with a legal copyright. Once you’ve published an item, the copyright date is set. So, if I posted an article on my blog in 2006, it still has a copyright of 2006, no matter what copyright date is listed at the bottom of the Web page. In addition, if you ever did run into a case where a site was infringing the copyright of some of your content, you’d want the original copyright date to prove that your content preceded what appears on the copycat site.

  11. Here is the code I use on my classic asp pages.

    Copyright © 1998 – <%=Year(Date)%&rt;

    And for ASP.NET

    Copyright © 1998 – <%=DateTime.Now.Year()%- &rt;

  12. Here is the code I use on my classic asp pages.

    Copyright © 1998 – <%=Year(Date)%>

    And for ASP.NET

    Copyright © 1998 – <%=DateTime.Now.Year()%>

    (Sorry about the double post. I second the preview idea!)

  13. I guy I met once, used to have some text in his website’s footer stating ‘Page last updated DD-MM-YYYY’ which just showed that days’ date pulled in with PHP. His boss thought he was so hard working, updating the site every day!

  14. @Phil: Hilarious!

  15. @bekee:
    Try that and you’ll may notice a *slight* difference between IE 6 and 7.
    That gave me a lot of headaches until I found this:
    http://www.quirksmode.org/js/introdate.html
    enjoy.

  16. The question is not to find a nice way to print the current year in the footnote (even a newby can do that), but whether which year should be displayed, and if the copyright notice should be printed at all.

    Under the 1886 Berne Convention, copyrights for creative works do not have to be asserted or declared, as they are automatically in force at creation. Most developed countries in the world signed the Berne convention.

    Instead, the USA and most Latin American countries entered into the Buenos Aires Convention in 1910, with which a copyright notice was part of statutory requirements.

    The world trade organization incorporated the Berne convention in its TRIP agreements in 2002.

    Hence, this notice is pointless, because author ownership is automatically acknowledged.

  17. @Régis: That explanation was incredible — thank you! That said, if the notice is pointless, it may as well display the current year.

  18. While it’s true that just posting unique content to a Web page automatically gives copyright ownership to the author, if you really want to assert a copyright you should put a copyright notice and date on the published content. In the US, if you are afraid that the copyright on your material might be infringed by a third party you should register your copyrighted material with the US Copyright Office–this is the best way to establish copyright date, and is required if you ever need to take legal action against someone infringing your content. This is probably too much work for most content–especially blog posts and other shorter content–but if you were Web site were totally dependent upon ownership of your content (like a complete book you placed online), it’s worth looking into registering your copyrighted material. YOu can find some more info here: http://www.copyrightkids.org/cbasicsframes.htm

  19. It’s an hypothesis, but maybe theses bigs companies hardcode the copyright strings in their template to same some CPU during the page generation. For a blog or a website with few visitors, it’s a great idea to use Date('Y'); but when you have a lot of visitors (example, google, facebook, …) this could help to save maybee, few milliseconds, but also few servers, for maybe, depending of your opinion, a little detail ^^

  20. i always use

  21. Henry Bowman

    Back when I worked for a Large Computer Manufacturer (who no longer exists), we were told by our company lawyers that “Copyright … 1998-2002″ was a defective notation, and that we must use “Copyright … 1998, 1999, 2000, 2002″ even when it got long and unwieldy, and also including only the years in which the work was actually changed. Since they were large and scary lawyers, we complied, and I have been doing it that way ever since. If you have larger and scarier lawyers who can rebut this, I will be pleased to lay down my mental burden.

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!

Recently on David Walsh Blog

  • Introducing Frontend Masters (with Giveaway)

    Hey DWB readers, I'm super happy to sponsor this blog. I've been a long-time reader and fan, since back when David wrote about JavaScript and MooTools back in 2007. ;-) We are in one of the fastest changing, evolving, most lively communities on earth: JavaScript and front-end web...

  • Get Node.js Command Line Arguments with yargs

    Using command line arguments within Node.js apps is par for the course, especially when you're like me and you use JavaScript to code tasks (instead of bash scripts).  Node.js provides process.argv but that doesn't provide a key: value object like you'd expect: Bleh.  If you want to work with a...

  • OâReilly Velocity Conference â New York

    My favorite front-end conference has always been O'Reilly's Velocity Conference because the conference series has focused on one of the most undervalued parts of client side coding:  speed.  So often we're so excited that our JavaScript works that we forget that speed, efficiency, and performance are just as important. The next Velocity...

  • Free Download: Font Bundle Featuring 17 Incredible Typefaces

    The only thing we love more than a good font, is a good free font. So we’ve combed the Web for some of our favorite free fonts, and gathered them here in a single download. You’ll find a variety of useful typefaces, from highly geometric designs...

  • OâReilly Velocity Conference â Amsterdam

    My favorite front-end conference has always been O'Reilly's Velocity Conference because the conference series has focused on one of the most undervalued parts of client side coding:  speed.  So often we're so excited that our JavaScript works that we forget that speed, efficiency, and performance are just as important. The next Velocity...