Prev: FAQ Topic - How do I generate a random integer from 1 to n? (2010-04-03)
Next: active (x)html newsgroup?
From: Dr J R Stockton on 9 Apr 2010 14:05 In comp.lang.javascript message <ac65084a-7a86-4584-96f2-d4bf12c650ae(a)k1 3g2000yqe.googlegroups.com>, Wed, 7 Apr 2010 18:51:26, RobG <rgqld(a)iinet.net.au> posted: >function STonoff() { > var J, K, Y = (new Date).getFullYear(); > document.write("Five years; seven civil days always crossing", " >EU Summer Time changes\nYear Spring Autumn"); > for (K = -2; K <= 2; K++) { > J = Y + K; > var D1 = new Date(J, 3, -6); > var D2 = new Date(J, 3, 1); > var X1 = (D2 - D1) / 86400000; > var D3 = new Date(J, 10, -6); > var D4 = new Date(J, 10, 1); > var X2 = (D4 - D3) / 86400000; > document.write("\n", J, " ", StrU(X1, 1, 6), " ", StrU(X2, 1, >6)); > } >} >1. Apparently it "calculates the difference in 24-hour days between >civil dates a week apart, necessarily spanning each EU clock >transition". I'd rather say in 86400-second days. ><URL: http://www.merlyn.demon.co.uk/js-date3.htm#DL > If you can, please adjust the dates for Australia and try it in Opera 10.51 or thereabouts, contrasting the results with those in Opera <= 10.10 or with another browser. There is no harm in broadening the range of K, if your aim is uncertain -- (c) John Stockton, nr London UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME. Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links. Proper <= 4-line sig. separator as above, a line exactly "-- " (RFCs 5536/7) Do not Mail News to me. Before a reply, quote with ">" or "> " (RFCs 5536/7) |