Results 1 to 4 of 4
Thread: getting correct time zone in HPI
- 06-30-2010, 03:14 PM #1
Member
- Join Date
- Jun 2010
- Posts
- 2
- Rep Power
- 0
getting correct time zone in HPI
Hi
I have requirement that i need to get the timezone of the system in java class and instantiate this value in configuration file. Subsequently i use TZ value stored in configuration fiile, in my scripting.
For this i am using TimeZone.getDefault().getID() API to get the TimeZone. It returns America/Los_Angeles in one of the HPI system. But AIX 5.3
and HPI does not support long TZ string.
How can i convert TZ like America/Los_Angeles to PST8PDT. or is there any way to get the timezone object which is supported in all the platforms.
Thanks in Advance.
- 06-30-2010, 04:01 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,601
- Blog Entries
- 7
- Rep Power
- 17
- 07-02-2010, 08:24 AM #3
Member
- Join Date
- Jun 2010
- Posts
- 2
- Rep Power
- 0
Yes, TimeZone.getDefault().getID() returns America/Los_Angeles. If we set this value for TZ environment variable, there will be time stamp difference
--------------------------------------------------------
bash-4.0$ uname -a
HP-UX staod03 B.11.31 U ia64 3712220453 unlimited-user license
bash-4.0$ env |grep TZ
TZ=PST8PDT
bash-4.0$ date
Fri Jul 2 00:03:21 PDT 2010
bash-4.0$ export TZ=America/Los_Angeles
bash-4.0$ date
Fri Jul 2 07:03:30 America/Los_Angeles 2010
bash-4.0$ export TZ=PST8PDT
bash-4.0$ date
Fri Jul 2 00:05:30 PDT 2010
---------------------------------------------------
- 07-02-2010, 02:46 PM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,601
- Blog Entries
- 7
- Rep Power
- 17
Your example shows that on your system(s) the America/Los_Angeles timezone and the PST8PDT timezone are seven hours apart; if there is daylight saving time to me it looks that the America/Los_Angelse timezone is treated as GMT+0 ... does it recognize the America/Los_Angeles timezone? (look ik your TZ database).
kind regards,
Jos
Similar Threads
-
Time Zone Problem on Windows
By yzaltz in forum New To JavaReplies: 4Last Post: 09-29-2010, 01:38 PM -
JAXB: After customizing to Java Date, can I control marshalling to exclude time zone?
By queuetip in forum XMLReplies: 0Last Post: 02-22-2010, 01:44 AM -
Time zone stamp
By ddscart in forum New To JavaReplies: 1Last Post: 08-02-2009, 08:41 PM -
time Zone
By mohammedsiddig in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 09-07-2008, 03:38 PM -
How to install tzdata2007i (updated Time zone database) in JDK 1.5.0_12-b04
By Santhosh in forum Advanced JavaReplies: 0Last Post: 11-06-2007, 02:16 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks