Re: time zone



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.
.



Relevant Pages

  • Re: explain what this means
    ... function getObj{var T ... jscr maths, dates, sources. ... TP/BP/Delphi/jscr/&c, FAQ items, links. ... Prev by Date: ...
    (comp.lang.javascript)
  • Re: beginner: regex how to check that value is only numbers
    ... ignorant generally intend. ... jscr maths, dates, sources. ... TP/BP/Delphi/jscr/&c, FAQ items, links. ... Prev by Date: ...
    (comp.lang.javascript)
  • Re: get ip
    ... ISTM you have a colon too many. ... jscr maths, dates, sources. ... TP/BP/Delphi/jscr/&c, FAQ items, links. ... Prev by Date: ...
    (microsoft.public.scripting.jscript)
  • Re: Number problem
    ... Lasse Edsvik posted: ... jscr maths, dates, sources. ... TP/BP/Delphi/jscr/&c, FAQ items, links. ... Prev by Date: ...
    (microsoft.public.scripting.vbscript)
  • Re: Convert to VBScript to JavaScript ?
    ... ISTM add 7 for next Friday. ... jscr maths, dates, sources. ... TP/BP/Delphi/jscr/&c, FAQ items, links. ... Prev by Date: ...
    (comp.lang.javascript)

Loading