Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with date calculation.

Status
Not open for further replies.

Vadim

Programmer
Feb 5, 2002
75
US
I tried to populate my <select> field with weekending dates,
and found that it work fine until 04/11/2004. You may also try this:
=========================================================
sunday = new Date(2004, 3, 11);
sunday.setTime(sunday.getTime() - (6 * 86400000));
alert(sunday);

sunday = new Date(2004, 3, 11);
sunday.setTime(sunday.getTime() - (7 * 86400000));
alert(sunday);
=========================================================
I got Monday apr 5 2004 and Saturday apr 3 2004.

Where is the Sunday apr 4 2004?

Is anybody knows what is special about this date?
 

Isn't that the date when the clocks change? You might find it works if you add a time into the equation - say something like 6pm (18:00) hours:

Code:
var sunday = new Date(2004, 3, 11, 18);

Hope this helps,
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top