This is just a little script that I use in the bottom of all the sites my company creates so we don’t spend so much time changing the date at the bottom of the page when we enter a new year.
First we have to establish the date the site was created. We need a full string to compare so the month and date don’t really matter. We just need a full date or the DateFormat function will not understand what is it we are trying to tell it.
<!--- the year the site was created --->
<CFSET startYear = DateFormat('1/1/2001', 'yyyy')>
Now we have to determine what year we are currently in. This is easy we just use the ColdFusion function now() in place of the actual date.
<!--- the current year --->
<CFSET nowYear = DateFormat(now(), 'yyyy')>
The next and final step is to output the dates and use an IF statement to determine if the startYear and nowYear date are different.
<!--- output the date --->
<CFOUTPUT>
© #startYear#
<!--- if the startYear and nowYear are different then show the beginning and ending years --->
<CFIF startYear neq nowYear>
- #nowYear#
</CFIF>
</CFOUTPUT>
THE SITE NAME HERE
That’s it. Now you’ll never have to change the copyright year again. Now just use this as an include on the page you would like to display the copyright info on.