| Welcome to WebmasterWorld Guest from 184.108.40.206 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Become a Pro Member|
|dealing with summer time|
romance standard time +2
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?
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))
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.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved