Re: time zone
- From: Dr John Stockton <jrs@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 6 Oct 2005 21:45:24 +0100
JRS: In article <h_81f.27682$K91.20780@xxxxxxxxxxxxxxxxxxxx>, dated
Thu, 6 Oct 2005 12:43:57, seen in news:comp.lang.javascript, Mick White
<mwhite13BOGUS@xxxxxxxxxxxxxxxx> posted :
>startDST.setDate(1 + (7-startDST.getDay())%7)
> endDST.setDate(31 - endDST.getDay() + 7)%7);
Unnecessary arithmetic, even if correct, which the second cannot be.
One need only go back by the 0..6 days given by getDay() from the last
possible date. No need for mod 7 here.
Actually, after new Date(), setDate(2) will be just as accurate as your
inrtended code for startDST, and after the end of this Summer,
setDate(29) for endDST.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
.
- References:
- time zone
- From: soup_or_power
- Re: time zone
- From: Mick White
- Re: time zone
- From: soup_or_power
- Re: time zone
- From: Mick White
- time zone
- Prev by Date: AJAX based autocomplete
- Next by Date: Re: AJAX based autocomplete
- Previous by thread: Re: time zone
- Next by thread: Re: time zone
- Index(es):
Relevant Pages
|
Loading