Make your own free website on Tripod.com

How many days are there in Feb 2004 ?
ericlin@ms1.hinet.net


There are several ways to get how many days there are in Feb 2004.

We can calculate whether 2004 is a leap year or not. Or, we can subtract March 1, 2004 with Feb 1, 2004 to get how many msec and then convert msec to days.

The simplest way is: get the date before March 1, 2004.

March 1, 2004 is Date.UTC(2004,2,1); So the day before it is Date.UTC(2004,2,0);

date1=new Date(); 
date1.setTime(Date.UTC(2004,2,0)); 
trace(date1.toString());
trace(date1.getDate());


Do you know that the date:  Jan -5, 2004  equals the date of Dec 26, 2003 ?

So, if some one ask me: what is the date 200 days after Christmas of 2004 ?

OK, it is Date.UTC(2004,11,25+200);