Article View: borland.public.jbuilder.java.language
Article #7679Re: Adding to time
From: John McGrath TeamB
Date: Fri, 25 May 2001 07:25
Date: Fri, 25 May 2001 07:25
32 lines
1884 bytes
1884 bytes
On Thu, 24 May 2001 09:40:31 -0500, hogar wrote:
> This should be simple but I am new to javascript
If you really mean JavaScript, then you are in the wrong place. This
newsgroup deals with the Java language, not JavaScript. Those are two
entirely different languages. This similarity in names is unfortunate.
> All I want to do is get the current system time and
> add 1 hour to it.
>
> now.setTime(now.getTime() + 1:00:00);
> return now;
The "time" value used by the java.util.Date class is a long value equal
to the number of milliseconds since the start of the "epoch", which is
January 1, 1970 at 0:00 UT. So to add an hour, you would have to add
1000 * 60 * 60, or 3,600,000.
You can also use the java.util.Calendar class to manipulate date/time
values. It is hard to say which is more appropriate without knowing
the details of your application, but I suspect that either approach
will work for you.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<MPG.1577cba7ea082af398a21f@forums.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!fu-berlin.de!news.boerde.de!dnewsReferences:
<3b0d1e01_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,ce0cd4a71832c80c X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-05-25 00:44:01 PST From: John McGrath [TeamB] <ng-b@JPMcGrath.net> Newsgroups: borland.public.jbuilder.java.language Subject: Re: Adding to time Date: Fri, 25 May 2001 03:25:47 -0400 Message-ID: <MPG.1577cba7ea082af398a21f@forums.borland.com> References: <3b0d1e01_1@dnews> X-Newsreader: MicroPlanet Gravity v2.30 NNTP-Posting-Host: 209.92.40.60 X-Trace: dnews 990775545 209.92.40.60 (25 May 2001 00:25:45 -0700) Lines: 32 X-Authenticated-User: jpmcgrath Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!fu-berlin.de!news.boerde.de!dnews