Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #16158

Re: How to construct a tomorrow?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!aioe.org!.POSTED!not-for-mail
From Christoph Becker <cmbecker69@gmx.de>
Newsgroups comp.lang.javascript
Subject Re: How to construct a tomorrow?
Date Thu, 27 Sep 2012 00:58:35 +0200
Organization Aioe.org NNTP Server
Lines 24
Message-ID <k401aj$jnh$1@speranza.aioe.org> (permalink)
References <6aae09ab-0d45-4c30-accf-909d7445c6a2@o8g2000yqm.googlegroups.com>
NNTP-Posting-Host QGGboTlrZLSM0JOcCcbD0Q.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:16158

Show key headers only | View raw


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

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to construct a tomorrow? justaguy <lichunshen84@gmail.com> - 2012-09-26 14:47 -0700
  Re: How to construct a tomorrow? Christoph Becker <cmbecker69@gmx.de> - 2012-09-27 00:58 +0200
    Re: How to construct a tomorrow? justaguy <lichunshen84@gmail.com> - 2012-09-26 17:47 -0700
      Re: How to construct a tomorrow? Gene Wirchenko <genew@ocis.net> - 2012-09-26 19:53 -0700
        Re: How to construct a tomorrow? Dr J R Stockton <reply1239@merlyn.demon.co.uk.invalid> - 2012-09-28 18:40 +0100
          Re: How to construct a tomorrow? Gene Wirchenko <genew@ocis.net> - 2012-09-29 20:52 -0700
    Re: How to construct a tomorrow? Dr J R Stockton <reply1239@merlyn.demon.co.uk.invalid> - 2012-09-28 18:30 +0100
      Re: How to construct a tomorrow? Christoph Becker <cmbecker69@gmx.de> - 2012-09-29 02:00 +0200
        Re: How to construct a tomorrow? John G Harris <john@nospam.demon.co.uk> - 2012-09-29 10:02 +0100
        Re: How to construct a tomorrow? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-30 14:29 +0200
          Re: How to construct a tomorrow? Christoph Becker <cmbecker69@gmx.de> - 2012-09-30 23:24 +0200
        Re: How to construct a tomorrow? Dr J R Stockton <reply1239@merlyn.demon.co.uk.invalid> - 2012-09-30 19:55 +0100
  Re: How to construct a tomorrow? Dr J R Stockton <reply1239@merlyn.demon.co.uk.invalid> - 2012-09-27 21:32 +0100
    Re: How to construct a tomorrow? Christoph Becker <cmbecker69@gmx.de> - 2012-09-28 01:03 +0200
      Re: How to construct a tomorrow? Gene Wirchenko <genew@ocis.net> - 2012-09-27 16:36 -0700
      Re: How to construct a tomorrow? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-28 10:37 +0200
      Re: How to construct a tomorrow? Dr J R Stockton <reply1239@merlyn.demon.co.uk.invalid> - 2012-09-29 20:39 +0100
        Re: How to construct a tomorrow? Christoph Becker <cmbecker69@gmx.de> - 2012-09-30 23:37 +0200
    Re: How to construct a tomorrow? Andrew Poulos <ap_prog@hotmail.com> - 2012-09-28 09:25 +1000
    Re: How to construct a tomorrow? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-09-28 08:37 -0700
      Re: How to construct a tomorrow? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-28 18:48 +0200
      Re: How to construct a tomorrow? Dr J R Stockton <reply1239@merlyn.demon.co.uk.invalid> - 2012-09-29 20:40 +0100
        Re: How to construct a tomorrow? Andrew Poulos <ap_prog@hotmail.com> - 2012-09-30 18:32 +1000
    Re: How to construct a tomorrow? Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2012-09-28 23:57 +0200
      Re: How to construct a tomorrow? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-30 13:49 +0200

csiph-web