Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to construct a tomorrow?

17 views
Skip to first unread message

justaguy

unread,
Sep 26, 2012, 5:47:31 PM9/26/12
to

var today = new Date();
today = today.toDateString();
// alert(today);
// all good

how do we get tomorrow based on today?
var tomorrow = today + 1
// definitely won't work
// and javascript does not something like dateAdd function or method
// googling get some long worded code to get a little thing done, your
thoughts?

Thanks.

Christoph Becker

unread,
Sep 26, 2012, 6:58:35 PM9/26/12
to
justaguy wrote:
> how do we get tomorrow based on today?

That's all explained on
<https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date>:

| The JavaScript date is measured in milliseconds since midnight
| 01 January, 1970 UTC. A day holds 86,400,000 milliseconds.

| getTime
| Returns the numeric value of the specified date as the number of |
milliseconds since January 1, 1970, 00:00:00 UTC (negative for
| prior times).

So a simple solution is:

var today = new Date();
var tomorrow = new Date(today.getTime() + 86400000)

For further details on date calculations have a look at the parameters
of the constructor function and the get*() methods of Date.

--
Christoph M. Becker

justaguy

unread,
Sep 26, 2012, 8:47:49 PM9/26/12
to
On Sep 26, 6:58 pm, Christoph Becker <cmbecke...@gmx.de> wrote:
> justaguy wrote:
> > how do we get tomorrow based on today?
>
> That's all explained on
> <https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_...>:
>
> | The JavaScript date is measured in milliseconds since midnight
> | 01 January, 1970 UTC. A day holds 86,400,000 milliseconds.
>
> | getTime
> |   Returns the numeric value of the specified date as the number of  |
>   milliseconds since January 1, 1970, 00:00:00 UTC (negative for
> |   prior times).
>
> So a simple solution is:
>
> var today = new Date();
> var tomorrow = new Date(today.getTime() + 86400000)
>
> For further details on date calculations have a look at the parameters
> of the constructor function and the get*() methods of Date.
>
> --
> Christoph M. Becker

Beautiful, thank you, With the same token, we can set a variable for
the day after tomorrow as well, I tested it and it works.

Gene Wirchenko

unread,
Sep 26, 2012, 10:53:40 PM9/26/12
to
On Wed, 26 Sep 2012 17:47:49 -0700 (PDT), justaguy
<lichun...@gmail.com> wrote:

>On Sep 26, 6:58 pm, Christoph Becker <cmbecke...@gmx.de> wrote:
>> justaguy wrote:
>> > how do we get tomorrow based on today?
>>
>> That's all explained on
>> <https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_...>:
>>
>> | The JavaScript date is measured in milliseconds since midnight
>> | 01 January, 1970 UTC. A day holds 86,400,000 milliseconds.
>>
>> | getTime
>> |   Returns the numeric value of the specified date as the number of  |
>>   milliseconds since January 1, 1970, 00:00:00 UTC (negative for
>> |   prior times).
>>
>> So a simple solution is:
>>
>> var today = new Date();
>> var tomorrow = new Date(today.getTime() + 86400000)

Or
var Tomorrow=new Date();
Tomorrow.setDate(Tomorrow.getDate()+1);

Yes, this works even at the end of a month.

>> For further details on date calculations have a look at the parameters
>> of the constructor function and the get*() methods of Date.

And watch it! 1) Date's .getDay() does not get the day of the
month. 2) Date's month values are off by 1. 3) Date's .getYear()
does not get the year. 4) I would not be surprised if there were a
fourth item. Truly, the Date object could have been defined better.

Sincerely,

Gene Wirchenko

Dr J R Stockton

unread,
Sep 27, 2012, 4:32:36 PM9/27/12
to
In comp.lang.javascript message <6aae09ab-0d45-4c30-accf-909d7445c6a2@o8
g2000yqm.googlegroups.com>, Wed, 26 Sep 2012 14:47:31, justaguy
<lichun...@gmail.com> posted:
Read <http://www.merlyn.demon.co.uk/js-dates.htm> and its friends, and
save the rest of us getting terribly terribly tired of you.

Also, please indicate whether you come from an English-speaking country,
or the USA, or elsewhere. It will help us to judge your IQ from tour
writing, which is all we have to go on, Otherwise, the worst is likely
to be assumed.

--
(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.
Check boilerplate spelling -- error is a public sign of incompetence.
Never fully trust an article from a poster who gives no full real name.

Christoph Becker

unread,
Sep 27, 2012, 7:03:19 PM9/27/12
to
Dr J R Stockton wrote:
> Also, please indicate whether you come from an English-speaking country,
> or the USA

Could you /please/ define "English-speaking country". In school and
later on I learned that there are differences between British English
and American English, but it seems you're classifying both as different
languages. This is quite confusing for me, as because I'm a native
German speaker with only a rough understanding of the English language,
I'm not able to assess this.

--
Christoph M. Becker

Andrew Poulos

unread,
Sep 27, 2012, 7:25:12 PM9/27/12
to
On 28/09/2012 6:32 AM, Dr J R Stockton wrote:

> or the USA, or elsewhere. It will help us to judge your IQ from tour
> writing, which is all we have to go on. Otherwise, the worst is likely

Bummer about using "tour" (when you probably meant "your") while trying
to insult some anonymous person about their lack of intelligence :-)

Andrew Poulos

Gene Wirchenko

unread,
Sep 27, 2012, 7:36:04 PM9/27/12
to
A country where English is a major language. Yes, there are
differences between British and U.S. English (and other English
dialects as well). Some people play up the differences and pretend
that British English and U.S. English are different languages. They
are not.

Sincerely,

Gene Wirchenko

Thomas 'PointedEars' Lahn

unread,
Sep 28, 2012, 4:37:49 AM9/28/12
to
Please do not feed the troll.


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann

Daniel Pitts

unread,
Sep 28, 2012, 11:37:19 AM9/28/12
to
On 9/27/12 1:32 PM, Dr J R Stockton wrote:
> In comp.lang.javascript message <6aae09ab-0d45-4c30-accf-909d7445c6a2@o8
> g2000yqm.googlegroups.com>, Wed, 26 Sep 2012 14:47:31, justaguy
> <lichun...@gmail.com> posted:
>
>>
>> var today = new Date();
>> today = today.toDateString();
>> // alert(today);
>> // all good
>>
>> how do we get tomorrow based on today?
>> var tomorrow = today + 1
>> // definitely won't work
>> // and javascript does not something like dateAdd function or method
>> // googling get some long worded code to get a little thing done, your
>> thoughts?
>
> Read <http://www.merlyn.demon.co.uk/js-dates.htm> and its friends, and
> save the rest of us getting terribly terribly tired of you.
>
> Also, please indicate whether you come from an English-speaking country,
> or the USA, or elsewhere. It will help us to judge your IQ from tour
> writing, which is all we have to go on, Otherwise, the worst is likely
> to be assumed.
Why should we judge someone's IQ at all? Why not always speak/write as
clearly we possibly can, explaining things with intuitive analogies,
using as few ambiguous clauses as possible.

The original poster is not the *only* audience for your posts. So
someone who comes by later and has a similar problem as the OP can also
learn from your responses, whether their (perceived) IQ is higher or
lower than the OP's (perceived) IQ.

Just because you put Dr before your name, doesn't make you better or
smarter than *anyone* else. Do you even really have a PhD? Do you really
think that matters? Your condescension should make you feel ashamed of
yourself.

Oh, and as for getting tired of a poster, no one asked *you* personally
to read all of their posts. If you don't feel like answering politely
and in the spirit of community, you may as well delete your news-reader
and leave us alone.

Thomas 'PointedEars' Lahn

unread,
Sep 28, 2012, 12:48:56 PM9/28/12
to
John Stockton's publicly uttered irritation is understandable to the extent,
and only to it, that the OP have not been asking a single smart question
since they got here: they do not care to read the good manuals available for
free online which would probably answer their questions without posting,
they blame the programming language(s) for their failings, and they continue
to ignore basic posting guidelines that have been repeatedly laid out to
them by more patient responders (and the FAQ, of course).

So this newsgroup can do without those questions, his condescending attitude
when responding to them, the attached colonialism and xenophobia, and
finally these meta-subthreads altogether.


PointedEars
--
Sometimes, what you learn is wrong. If those wrong ideas are close to the
root of the knowledge tree you build on a particular subject, pruning the
bad branches can sometimes cause the whole tree to collapse.
-- Mike Duffy in cljs, <news:Xns9FB6521286...@94.75.214.39>

Eric Bednarz

unread,
Sep 28, 2012, 5:57:18 PM9/28/12
to
Dr J R Stockton <repl...@merlyn.demon.co.uk.invalid> writes:

> Also, please indicate whether you come from an English-speaking country,
> or the USA, or elsewhere. It will help us to judge your IQ from tour
> writing, [...]

Still having trouble with that pesky touring test, don't you?

Dr J R Stockton

unread,
Sep 28, 2012, 1:30:52 PM9/28/12
to
In comp.lang.javascript message <k401aj$jnh$1...@speranza.aioe.org>, Thu,
27 Sep 2012 00:58:35, Christoph Becker <cmbec...@gmx.de> posted:

>justaguy wrote:
>> how do we get tomorrow based on today?

>So a simple solution is:
xxxxxx naive
>
>var today = new Date();
>var tomorrow = new Date(today.getTime() + 86400000)

And what happens when the interval crosses 01:00 UTC on the last Sundays
of March and October? (dates and times are different for chronologically
inconvenient locations).

Also, 86400000 is better written as 864e5 - shorter, and avoids
miscounting zeroes.

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05.
Website <http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc. : <http://www.merlyn.demon.co.uk/programs/> - see in 00index.htm
Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.

Dr J R Stockton

unread,
Sep 28, 2012, 1:40:52 PM9/28/12
to
In comp.lang.javascript message <djf7689j7ruhk20bn8lqsujhr8de3qk06l@4ax.
com>, Wed, 26 Sep 2012 19:53:40, Gene Wirchenko <ge...@ocis.net> posted:

>
> And watch it! 1) Date's .getDay() does not get the day of the
>month. 2) Date's month values are off by 1. 3) Date's .getYear()
>does not get the year. 4) I would not be surprised if there were a
>fourth item. Truly, the Date object could have been defined better.

I blame all of that on Canada, for not enlightening their southern
neighbours previously.

For a better but compatible Date Object, see
<http://www.merlyn.demon.co.uk/js-dobj2.htm>.

For a really bad implementation, see Safari 5 for Windows (Mac? etc.?),
part of which does not correctly interpret /Inter Gravissimas/ - test in
<http://www.merlyn.demon.co.uk/js-datex.htm>.

Christoph Becker

unread,
Sep 28, 2012, 8:00:31 PM9/28/12
to
Dr J R Stockton wrote:
> In comp.lang.javascript message <k401aj$jnh$1...@speranza.aioe.org>, Thu,
> 27 Sep 2012 00:58:35, Christoph Becker <cmbec...@gmx.de> posted:
>
>> justaguy wrote:
>>> how do we get tomorrow based on today?
>
>> So a simple solution is:
> xxxxxx naive
>>
>> var today = new Date();
>> var tomorrow = new Date(today.getTime() + 86400000)
>
> And what happens when the interval crosses 01:00 UTC on the last Sundays
> of March and October? (dates and times are different for chronologically
> inconvenient locations).

I *thought* a day is defined as having 86,400 seconds (cf.
<http://www.bipm.org/en/si/si_brochure/chapter4/table6.html>). If I am
mistaken in this view, please correct me -- I'll appreciate an
explanation or a link to one.

If you were referring to summer time issues, AFAIK this wouldn't be
relevant here, as the calculation is "internal", and the results
/should/ be faithfully presented in human readable form by calling
toLocalDateString().
>
> Also, 86400000 is better written as 864e5 - shorter, and avoids
> miscounting zeroes.
>
One might argue, that it's even better to write it as

24 * 60 * 60 * 1000

what is not as efficient and short, but indicates the meaning even more
clearly.

--
Christoph M. Becker

John G Harris

unread,
Sep 29, 2012, 5:02:48 AM9/29/12
to
On Sat, 29 Sep 2012 at 02:00:31, in comp.lang.javascript, Christoph
Becker wrote:
>Dr J R Stockton wrote:

<snip>
>I *thought* a day is defined as having 86,400 seconds (cf.
><http://www.bipm.org/en/si/si_brochure/chapter4/table6.html>). If I am
>mistaken in this view, please correct me -- I'll appreciate an
>explanation or a link to one.

The BIPM are ignoring leap seconds which make their definition of days
drift out of sync with UTC within a year or so.

Luckily, ECMAScript also knows nothing of leap seconds.


>If you were referring to summer time issues, AFAIK this wouldn't be
>relevant here, as the calculation is "internal", and the results
>/should/ be faithfully presented in human readable form by calling
>toLocalDateString().

Are you sure? It's safer to use setDate with the time set initially to
12 noon.


>> Also, 86400000 is better written as 864e5 - shorter, and avoids
>> miscounting zeroes.
>>
>One might argue, that it's even better to write it as
>
>24 * 60 * 60 * 1000
>
>what is not as efficient and short, but indicates the meaning even more
>clearly.

True, but Stockton has disliked it in the past. He doesn't go for clear.

John
--
John Harris

Dr J R Stockton

unread,
Sep 29, 2012, 3:39:31 PM9/29/12
to
In comp.lang.javascript message <k42lvo$rbf$1...@speranza.aioe.org>, Fri,
28 Sep 2012 01:03:19, Christoph Becker <cmbec...@gmx.de> posted:
The languages are different but with considerable overlap (linguistic
differences rarely affect careful technical writing such as should be
used here). I think the same may be true in regard to the German of
Germany, Switzerland, and Austria; and the French of France and Belgium.
It is certainly true in regard to the Latin of Caesar and of Euler.

But you have mis-parsed what I wrote, as has the local OAF. There is an
implicit "or not;" after "country". There are therefore two questions;
English-speaking or other, and USA or other. The latter is because of
the nature of the USA & its people; and especially their weirdness in
respect of writing date and time.

--

Dr J R Stockton

unread,
Sep 29, 2012, 3:40:21 PM9/29/12
to
In comp.lang.javascript message <Suj9s.3882$sB3....@newsfe05.iad>, Fri,
28 Sep 2012 08:37:19, Daniel Pitts <newsgrou...@virtualinfinity.net
> posted:

>On 9/27/12 1:32 PM, Dr J R Stockton wrote:

>> Also, please indicate whether you come from an English-speaking country,
>> or the USA, or elsewhere. It will help us to judge your IQ from tour
>> writing, which is all we have to go on, Otherwise, the worst is likely
>> to be assumed.
>Why should we judge someone's IQ at all? Why not always speak/write as
>clearly we possibly can, explaining things with intuitive analogies,
>using as few ambiguous clauses as possible.

Because, before replying, one must first try to determine what a poster
might mean from what the poster has written. That includes whether the
poster is a bumbling fool, or is handicapped by writing EFL.

>The original poster is not the *only* audience for your posts. So
>someone who comes by later and has a similar problem as the OP can also
>learn from your responses, whether their (perceived) IQ is higher or
>lower than the OP's (perceived) IQ.

You have a manifest, but justified, inferiority complex.

--
(c) John Stockton, nr London UK Reply address via Home Page.
news:comp.lang.javascript FAQ <http://www.jibbering.com/faq/index.html>.
<http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

Gene Wirchenko

unread,
Sep 29, 2012, 11:52:10 PM9/29/12
to
On Fri, 28 Sep 2012 18:40:52 +0100, Dr J R Stockton
<repl...@merlyn.demon.co.uk.invalid> wrote:

>In comp.lang.javascript message <djf7689j7ruhk20bn8lqsujhr8de3qk06l@4ax.
>com>, Wed, 26 Sep 2012 19:53:40, Gene Wirchenko <ge...@ocis.net> posted:
>
>>
>> And watch it! 1) Date's .getDay() does not get the day of the
>>month. 2) Date's month values are off by 1. 3) Date's .getYear()
>>does not get the year. 4) I would not be surprised if there were a
>>fourth item. Truly, the Date object could have been defined better.
>
>I blame all of that on Canada, for not enlightening their southern
>neighbours previously.

As a Canadian, I decline the blame.

>For a better but compatible Date Object, see
><http://www.merlyn.demon.co.uk/js-dobj2.htm>.

It is too late for me. I already have made Date work for me,
sort of.

>For a really bad implementation, see Safari 5 for Windows (Mac? etc.?),
>part of which does not correctly interpret /Inter Gravissimas/ - test in
><http://www.merlyn.demon.co.uk/js-datex.htm>.

You should have saved this for another month or so. Hallowe'en
would be a more appropriate time for this sort of thing. <BEG>

Sincerely,

Gene Wirchenko

Andrew Poulos

unread,
Sep 30, 2012, 4:32:09 AM9/30/12
to
On 30/09/2012 5:40 AM, Dr J R Stockton wrote:
> In comp.lang.javascript message <Suj9s.3882$sB3....@newsfe05.iad>, Fri,
> 28 Sep 2012 08:37:19, Daniel Pitts <newsgrou...@virtualinfinity.net
>> posted:
>
>> On 9/27/12 1:32 PM, Dr J R Stockton wrote:
>
>>> Also, please indicate whether you come from an English-speaking country,
>>> or the USA, or elsewhere. It will help us to judge your IQ from tour
>>> writing, which is all we have to go on, Otherwise, the worst is likely
>>> to be assumed.
>> Why should we judge someone's IQ at all? Why not always speak/write as
>> clearly we possibly can, explaining things with intuitive analogies,
>> using as few ambiguous clauses as possible.
>
> Because, before replying, one must first try to determine what a poster
> might mean from what the poster has written. That includes whether the
> poster is a bumbling fool, or is handicapped by writing EFL.
>
>> The original poster is not the *only* audience for your posts. So
>> someone who comes by later and has a similar problem as the OP can also
>> learn from your responses, whether their (perceived) IQ is higher or
>> lower than the OP's (perceived) IQ.
>
> You have a manifest, but justified, inferiority complex.

I like how you "slam" anyone that finds any your replies as offensive as
you apparently find those of PE.

Andrew Poulos

Thomas 'PointedEars' Lahn

unread,
Sep 30, 2012, 7:49:19 AM9/30/12
to
If the ability to drive a vehicle was indicative of a person's IQ, there
would be no traffic jams ;-)


PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)

Thomas 'PointedEars' Lahn

unread,
Sep 30, 2012, 8:29:43 AM9/30/12
to
Christoph Becker wrote:

> Dr J R Stockton wrote:
>> […] Christoph Becker <cmbec...@gmx.de> posted:
>>> justaguy wrote:
>>>> how do we get tomorrow based on today?
>>>
>>> So a simple solution is:
>> xxxxxx naive
>>>
>>> var today = new Date();
>>> var tomorrow = new Date(today.getTime() + 86400000)
>>
>> And what happens when the interval crosses 01:00 UTC on the last Sundays
>> of March and October? (dates and times are different for chronologically
>> inconvenient locations).
>
> I *thought* a day is defined as having 86,400 seconds (cf.
> <http://www.bipm.org/en/si/si_brochure/chapter4/table6.html>). If I am
> mistaken in this view, please correct me -- I'll appreciate an
> explanation or a link to one.

There are more definitions of "day" than that. You can start by reading the
corresponding Wikipedia article.

Even in standard time a day can have more or less seconds. For example, UTC
includes the concept of the leap second. (The Date object does not include
that concept, though.)

> If you were referring to summer time issues,

He was.

> AFAIK this wouldn't be relevant here, as the calculation is "internal",

It would be relevant.

> and the results /should/ be faithfully presented in human readable form by
> calling toLocalDateString().

The method is named `toLocal*e*DateString'; it refers to the system
*locale*, _not_ necessarily local time. It is specified in ECMAScript
Ed. 3, and fully supported since JScript 5.5.6330, JavaScript 1.5, V8
3.7.12.12, JSC 531.22.7, Opera 7.02, and KJS 4.6.5. Insofar it can be
considered safe for use.

Your assumption can be easily tested (in "Mozilla/5.0 (X11; Linux i686)
AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1"):

| > var today = new Date(2012, 9, 28);
| var tomorrow = new Date(today.getTime() + 864e5);
| console.log(today + "\n" + tomorrow);
| Sun Oct 28 2012 00:00:00 GMT+0200 (CEST)
| Sun Oct 28 2012 23:00:00 GMT+0100 (CET)
|
| > console.log(today.toLocaleDateString() + "\n"
| + tomorrow.toLocaleDateString());
| Sunday, October 28, 2012
| Sunday, October 28, 2012

So this approach evidently does not work. But the question was how to
construct a Date instance holding (a date of) tomorrow instead:

| > var tomorrow = new Date(2012, 9, 28);
| undefined
|
| > tomorrow
| Sun Oct 28 2012 00:00:00 GMT+0200 (CEST)
|
| > tomorrow.setDate(tomorrow.getDate() + 1);
| 1351465200000
|
| > tomorrow
| Mon Oct 29 2012 00:00:00 GMT+0100 (CET)

>> Also, 86400000 is better written as 864e5 - shorter, and avoids
>> miscounting zeroes.
>
> One might argue, that it's even better to write it as
>
> 24 * 60 * 60 * 1000
>
> what is not as efficient and short, but indicates the meaning even more
> clearly.

And it also shows why that number fails to accomplish "[getting] tomorrow
based on today".

Christoph Becker

unread,
Sep 30, 2012, 5:24:01 PM9/30/12
to
Thomas 'PointedEars' Lahn wrote:

[snip]

I stand corrected regarding all points. Thanks for your comments. :-)
These show clearly that I obviously haven't understood the ECMAScript
Date object and how it is supposed to work (and apparently some more
general concepts of date/time). I will consult the specs and other
readings and try to catch up on this.

--
Christoph M. Becker

Christoph Becker

unread,
Sep 30, 2012, 5:37:40 PM9/30/12
to
Dr J R Stockton wrote:
> But you have mis-parsed what I wrote, as has the local OAF. There is an
> implicit "or not;" after "country". There are therefore two questions;
> English-speaking or other, and USA or other.
^^^

Ah, now I understand. :-)

--
Christoph M. Becker

Dr J R Stockton

unread,
Sep 30, 2012, 2:55:29 PM9/30/12
to
In comp.lang.javascript message <k45dmn$8j7$1...@speranza.aioe.org>, Sat,
29 Sep 2012 02:00:31, Christoph Becker <cmbec...@gmx.de> posted:

>Dr J R Stockton wrote:
>> In comp.lang.javascript message <k401aj$jnh$1...@speranza.aioe.org>, Thu,
>> 27 Sep 2012 00:58:35, Christoph Becker <cmbec...@gmx.de> posted:
>>
>>> justaguy wrote:
>>>> how do we get tomorrow based on today?
>>
>>> So a simple solution is:
>> xxxxxx naive
>>>
>>> var today = new Date();
>>> var tomorrow = new Date(today.getTime() + 86400000)
>>
>> And what happens when the interval crosses 01:00 UTC on the last Sundays
>> of March and October? (dates and times are different for chronologically
>> inconvenient locations).
>
>I *thought* a day is defined as having 86,400 seconds (cf.
><http://www.bipm.org/en/si/si_brochure/chapter4/table6.html>). If I am
>mistaken in this view, please correct me -- I'll appreciate an
>explanation or a link to one.

You had one, near enough, in my sig. The above link refers, manifestly,
to SI days. Civil days may vary from that by -1, -0.5, +0.5, +1 hours
and also +1 second and -1 second. The legal UK civil day is still, I
believe, GMT-based, so the +1/-1 second is here in principle replaced by
a rather small fraction of a second. (Then there are sidereal days,
Martian days, ... )

>If you were referring to summer time issues, AFAIK this wouldn't be
>relevant here, as the calculation is "internal", and the results
>/should/ be faithfully presented in human readable form by calling
>toLocalDateString().

AFAYK != AFAIK.

D1 = new Date("2012 Mar 24 23:30") // Sat Mar 24 2012 23:30:00
D2 = new Date(D1.getTime() + 864e5) // Mon Mar 26 2012 00:30:00

D1 = new Date("2012 Oct 28 00:30") // Sun Oct 28 2012 00:30:00
D2 = new Date(D1.getTime() + 864e5) // Sun Oct 28 2012 23:30:00

Those not testing in the British Isles may have to adjust the times
and/or the dates - especially any with the OS set for LHI.

JavaScript date work should, wherever practical, be done with the UTC
functions.
0 new messages