This little trick will automatically refresh the copyright year by inserting a simple JavaScript or php script. Although not required by law, it tells your visitor the site is current and can also reflect the longevity of your site when using the multiple years approach.

Using Javascript

Here’s the JavaScript. Copy and paste it wherever you want the current year to appear:

<script language=”javascript” type=”text/javascript”>
var today = new Date()
var year = today.getFullYear()
document.write(year)
</script>

Using php

Here’s the php script:

<?php echo date(‘Y’); ?>

The php script will require an additional step to make it run on html pages (not required for WordPress). You need to create or edit an .htaccess file. Adding this snippet of code to the .htaccess file will also allow other php scripts to run on your site, which can be extremely useful.

Creating the .htaccess File

To set up an .htaccess file, open a new file or open the existing .htaccess file in a text editor like Notepad or SimpleText. Paste the following code into the file:

AddType application/x-httpd-php .htm .html

After inserting the code in your text editor, click File > Save. For a new file, type .htaccess as the file name and from the Save as type dropdown menu, select All Files. Click Save, then go back and make sure the editor didn’t add an extension to the filename after .htaccess. If you find an extension, delete it. Upload the .htaccess file to the root directory of your website. This is the topmost folder of your website’s file structure and is usually named example.com or example.com/home.

(You may need to search your web host’s site for “How to parse php within html files”, as your web host might specify a different process for parsing php in html pages. Follow those directions instead on what code to enter in the .htaccess file.)

Updating Your Blog’s Copyright

You may not have access to the .htaccess file depending on what blogging platform your website uses. In that case, use the JavaScript code.

Copyright That Spans Several Years

A range of years next to your copyright symbol will remind your visitors how long you’ve been in business or how long your website has been up. Use the script to update the last year of your range. To do this, copy and paste the following as your copyright notice’s html code. Change 2006 to the year in which your site was established:

Copyright &copy; 2006&ndash;

Enter the JavaScript or php script for the current year immediately next to the semicolon.

Your copyright year updates are now automated.