The Copyright Year Dance

December 15, 2004

Get out your ‘to-do’ list and make a note to change the copyright year notices on your clients’ websites. Every new year brings with it the task of updating websites with the correct copyright year. As little of a task it is, it can be a pain when multiplied by several websites. I have visited several large sites in the past where their copyright year hadn’t been updated to the current year until March. As simple as a solution it is, many times we don’t do it. I am sure many of you already use date functions, but as a refresher let’s review them.

Date Functions

A date function will change the year automatically for you. Depending on the type of server your sites are set up on use one of the following in place of the year.

Apache Servers

You can use a server side include to call a built year function. The only drawback is that you can’t nest server side includes, so if you have a footer include you will have to work around the year.

<!--#config timefmt="%Y" -->
<!--#echo var="DATE_LOCAL" -->

PHP

You can nest php includes so this one works great.

<?php print date("Y")?>

ASP

Simple, easy and nestable like php.

<%Response.Write Year(date)%>

Movable Type

We all know this one.

<$MTDate format="%Y"$>

Javascript

If you must, I don’t suggest using javascript as it is client-side and visitors with javascript disabled won’t get it.

<script type="text/javascript">
var d = new Date()
document.write(d.getFullYear())
</script>

Another option is to custom write your own function or get a programmer buddy to do write one for you.

Comments

Jonathan Snook said:

For those who like to be succinct, the PHP and ASP versions can be written like:

<?=date("Y")?>  -php
<%=Year(date)%> -asp

Posted on Dec. 15, 2004 11:20 #

Jonathan Snook said:

oh, that wasn't nice... it worked on preview but not on save. Anyways, I was demonstrating the short form for PHP and ASP. Then again, if you know these languages, you probably already know the short form. :)

Posted on Dec. 15, 2004 11:25 #

Blake Scarbrough said:

I fixed it there for you Jon, now everyone can see the php asp shortcuts. Thanks for the input.

Posted on Dec. 15, 2004 11:40 #

Patrick Correia said:

Interesting technique... but isn't the date in the copyright notice supposed to be the date of first publication? In that case, why would you automatically change the date in the notice just because the current date is a new year? The US Copyright Office, a service unit of the Library of Congress, is the authority on copyright in the US and they cover the issue of copyright notices briefly in Circular 1, "Copyright Basics" and in more depth in Circular 3, "Copyright Notice".

Posted on Dec. 16, 2004 08:23 #

Blake Scarbrough said:

Patrick,
I see your point, the web is always changing and re-publishing new stuff all of the time. So you always want a the most recent copyright date. One thing I do on sites sometimes is list the copyright as © 1997 - 2004 (the current year). Like done on amazon.com.

Posted on Dec. 16, 2004 09:03 #

Nathan Logan said:

Mmmmmm... PHP. The best part of waking up.

Thanks for the reminder!

Posted on Dec. 28, 2004 10:36 #

Rob Dunn said:

Query to all:
I like the Javascript version. But, as you say, some folks have JS disabled.

Isn't there a simple HTML method to 'call-in' a 'text' entry that resides in a separate file that can be changed once a year so that all 'call-ins' see and display the new 'text'?

I apologize for being so naive, but I am still learning!

Posted on Jan. 2, 2005 21:55 #

Blake Scarbrough said:

Rob, you can use an include file to accomplish that, either with server side includes, php, or asp. PHP and ASP will allow you to next a function in the includes unlike SSI(server side includes).

Hope that helps.

Posted on Jan. 3, 2005 21:20 #