🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: aus.computers.java
Article #1142

Re: read local date?

#1142
From: Dion Gillard
Date: Sun, 23 May 1999 00:00
33 lines
1719 bytes
[This followup was posted to aus.computers.java and a copy was sent to 
the cited author.]

In article <3745CCE4.D778E9D1@ihug.com.au>, jho@ihug.com.au says...
|  Fred Ghelem wrote:
|  
|  > You have to change the Locale
|  
|  The problem is how to set it to be the same for the place where the
|  program is run?  how to get the locale  to be the same as the computer
|  which the program is running on??
|  What I have so far....
|  
|      TimeZone tz = TimeZone.getDefault();
|      Calendar rightNow = Calendar.getInstance(tz);
|      System.out.println("ID:" + tz.getID()+"  HOUR_OF_DAY: "
|                                              + rightNow.get(
|  Calendar.HOUR_OF_DAY ));
|  
|  and i get this under jdk1.1.7 in linux
|  
|  ID:EST  HOUR_OF_DAY: 17
|  
|  but if I get the REAL time/date of my linux box by typing 'date' in
|  console...i get
|  Sat May 22 07:13:52 EST 1999
|  
|  Which is a BIG difference...the timezone is correct, but hour is still
|  not. :(

Did you try using Locale.getDefault() for your timezone etc?

dIon
Technical Details
Message-ID: <MPG.11b26a83138ee530989681@news.ozemail.com.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <37455155.A27F043E@ihug.com.au> <s%d13.200$g26.524@nswpull.telstra.net> <3745CCE4.D778E9D1@ihug.com.au>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d6db,4bc291cb57391718
X-Google-Attributes: gid10d6db,public
From: dion@multitask.com.au (Dion Gillard)
Subject: Re: read local date?
Date: 1999/05/23
Message-ID: <MPG.11b26a83138ee530989681@news.ozemail.com.au>
X-Deja-AN: 481112879
Distribution: world
References: <37455155.A27F043E@ihug.com.au> <s%d13.200$g26.524@nswpull.telstra.net> <3745CCE4.D778E9D1@ihug.com.au>
X-Trace: ozemail.com.au 927448389 203.108.100.98 (Sun, 23 May 1999 18:33:09 EST)
Organization: Multitask Consulting
NNTP-Posting-Date: Sun, 23 May 1999 18:33:09 EST
Newsgroups: aus.computers.java