Article View: aus.computers.java
Article #1139Re: read local date?
From: jam
Date: Sat, 22 May 1999 00:00
Date: Sat, 22 May 1999 00:00
28 lines
1310 bytes
1310 bytes
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. :(
Any idea?
James.
Technical Details
Message-ID:
<3745CCE4.D778E9D1@ihug.com.au>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<37455155.A27F043E@ihug.com.au> <s%d13.200$g26.524@nswpull.telstra.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d6db,4bc291cb57391718 X-Google-Attributes: gid10d6db,public From: jam <jho@ihug.com.au> Subject: Re: read local date? Date: 1999/05/22 Message-ID: <3745CCE4.D778E9D1@ihug.com.au> X-Deja-AN: 480670714 Content-Transfer-Encoding: 7bit References: <37455155.A27F043E@ihug.com.au> <s%d13.200$g26.524@nswpull.telstra.net> Organization: The Internet Group Ltd Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: aus.computers.java