Article View: borland.public.jbuilder.java.language
Article #7683Re: Adding to time
From: Rich Wilkman
Date: Fri, 25 May 2001 18:11
Date: Fri, 25 May 2001 18:11
42 lines
2406 bytes
2406 bytes
John: Even more unfortunate is the similarity in "Object" names in JS with Java that often lead one down a merry path in JSP work. "Oh, you mean that really isn't a Date object?!" :-) -Rich "John McGrath [TeamB]" wrote: > > 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:
<3B0EA03B.1291E281@formlessvoid.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!newsfeed2.skycache.com!newsfeed.skycache.com!Cidera!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<3b0d1e01_1@dnews> <MPG.1577cba7ea082af398a21f@forums.borland.com>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 11:24:52 PST Message-ID: <3B0EA03B.1291E281@formlessvoid.com> Date: Fri, 25 May 2001 11:11:07 -0700 From: Rich Wilkman <richw@formlessvoid.com> X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language Subject: Re: Adding to time References: <3b0d1e01_1@dnews> <MPG.1577cba7ea082af398a21f@forums.borland.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 208.236.69.60 X-Trace: dnews 990814265 208.236.69.60 (25 May 2001 11:11:05 -0700) Lines: 42 Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!newsfeed2.skycache.com!newsfeed.skycache.com!Cidera!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews