Path: csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Christoph Becker Newsgroups: comp.lang.javascript Subject: Re: How to construct a tomorrow? Date: Sat, 29 Sep 2012 02:00:31 +0200 Organization: Aioe.org NNTP Server Lines: 39 Message-ID: References: <6aae09ab-0d45-4c30-accf-909d7445c6a2@o8g2000yqm.googlegroups.com> NNTP-Posting-Host: Ub9H783nL3Fv6T6iF+mbPA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.javascript:16238 Dr J R Stockton wrote: > In comp.lang.javascript message , Thu, > 27 Sep 2012 00:58:35, Christoph Becker 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. ). 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