View Full Version : Show last year please?

07-02-2005, 01:08 AM
How can I display the last year please? i.e. 2004 when the year is 2005 or 2006 when the year is 2007?

Had no luck finding a code in Google.

Thank you.

Willy Duitt
07-02-2005, 01:15 AM
Try: getFullYear()-1

07-02-2005, 02:03 AM
something like:

function getLastYear(){
var today = new Date();
var lastYear = today.getFullYear() -1;

return lastYear;

You can change the "return" for a "document.write" or "alert()" or whatever code you want :o

07-02-2005, 08:15 PM
Thank you very much :)