Update your copyright date automatically

It’s a new year, so why does your website still read © last year or worse?

Most web site owners forget to update their copyright date. And it’s easy to understand why. For most sites, the footer, where the copyright date usually sits, is below the fold and in small type anyways. But for site visitors, it can communicate the freshness of a website’s content. So it doesn’t hurt to make sure this information is updated.

You could do it manually, or like I did, by using a “Find and Replace” feature of my web programming program. An even better way is to present the date dynamically, and yes, even if you’re not using a server side technology like PHP or ASP.

Below are code snippets in various languages to present the current year on a web page. Note that I’m using the © character attribute for displaying the copyright symbol (and so should you).

Javascript

This code can be used on any web page, including static HTML pages.
<script type="text/javascript">
var theDate=new Date()
document.write(theDate.getFullYear())
</script>

PHP

&copy;<?php echo date(Y);?>
or
&copy;<? echo date(Y);?>

ASP

&copy;<%=year(date)%>

Coldfusion

<cfoutput>&copy; #Year(Now())#</cfoutput>

Server Side Includes (SSI)

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

0 Comments

Leave a Comment

Your email address will not be published. Required fields are marked *