Auto updating your copyright year

Since the new year is starting it’s time to make sure your copyright notices are up to date. Since you’re going to be changing it anyway here are 3 snippets of code to automatically insert the current year so you don’t have to worry about it next year.

PHP

PHP:
  1. <? echo date(‘Y’); ?>

ASP

ASP:
  1. <%=year(date)%>

ColdFusion

CODE:
  1. <cfoutput>&copy; #Year(Now())#</cfoutput>

SSI

CODE:
  1. <!–#config timefmt=“%Y” –><!–#echo var=“DATE_LOCAL” –>

Question, Comments...

Do you have more questions. Please either leave a comment below or join us in our new forum.

Leave a Reply