Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

dealing with summer time

romance standard time +2



8:08 am on Mar 18, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member


i've got a function which checks that there are minimum 3 days between 2 dates.

currently i convert to milliseconds and subtract one from the other and check that it is < 24*3600*1000*3

but this is giving me problems if i check dates around the 27th march - which is when summer time starts - i lose an hour and the function returns negative even there are 3 days in between.

is there a way around this particular problem?

many thanks!


5:12 pm on Mar 18, 2006 (gmt 0)

10+ Year Member

Yes, you should avoid calculating days using milliseconds because of daylight savings time. This should give you the idea.

return new Date(this.setDate(this.getDate()+days))

alert('-20 = '+new Date().moveDays(-20)+'\n\n+20 = '+new Date().moveDays(20))


9:00 am on Mar 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

hi gph,

that's what i've now done. i didn't actually understand what you meant, until i did some investigating and now it's clear.



Featured Threads

Hot Threads This Week

Hot Threads This Month