New Year’s Resolutions: Dynamically Update your Copyright Notices (includes all code samples)

New Year’s Resolutions: Dynamically Update your Copyright Notices (includes all code samples)

happy_new_yearOnly a couple of days left until we celebrate the new year. Champagne, parties, fireworks and yes, new years resolutions.

One thing that is on a lot of web professionals todo lists is to update their ‘Copyright’ notices. Or at least it should be.

A lot of websites take hours, days or even years to update. Google generally takes up to 48 hours to update all their footers but it is not unlikely to find “Copyright 2006” on some websites even today.

So why not automate the whole thing like we did for our blog? A few lines of code are enough to just print the year there. As long as your server’s internal clock is on time you will always display the current year.

Since you are going into code anyway you might as well change that “2010” to one of the dynamic code snippets below and you will be forever up-to-date:

<?php print date("Y"); ?>

<%response.write("Current Year: "&Year(Date))%>


<script type="text/javascript">
document.write(new Date().getFullYear())


import java.util.*;
import java.text.*;

public class Apollo {
public static void main(String[] args) {
Date date = new Date();
SimpleDateFormat simpleDateformat=new SimpleDateFormat("yyyy");

Unix Shell
date +%Y
Go (golang)
package main
import ("fmt"
func main() {
var t = time.LocalTime()

from datetime import date

x86 Assembly
jmp start
year db "0000$"
mov ah, 04h
int 1Ah

mov bh, ch
shr bh,4
add bh,30h
mov [year], bh
mov bh,ch
and bh,0fh
add bh,30h
mov [year+1],bh

mov bh, cl
shr bh,4
add bh,30h
mov [year+2], bh
mov bh,cl
and bh,0fh
add bh,30h
mov [year+3],bh

mov ah,09h
mov dx, offset year
int 21h

mov ah,4Ch
mov al,00
int 21h


(let [date (java.util.Date.)
sdf (java.text.SimpleDateFormat. "yyyy")]
(println (.format sdf date)))

int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSLog (@"%d", [[NSCalendarDate date] yearOfCommonEra]);
[pool drain];
return 0;

set year [clock format [clock seconds] -format {%Y}]
puts $year

ShowMessage( IntToStr(YearOf(Now)) );

import System.Time
main = getClockTime >>= toCalendarTime >>= print . ctYear

Any other code snippets that are useful?
Let me know in the comments so I can add them.

@redfeet: @Boris Asp.Net: <%=Now.Year.toString%> Classic ASP: <%=Year(Date())%>
all the best for the 10

Read next: 10 Things We Learnt About Smartphones In 2010

Pssst, hey you!

Do you want to get the sassiest daily tech newsletter every day, in your inbox, for FREE? Of course you do: sign up for Big Spam here.