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.

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 #