Results 1 to 4 of 4
  1. #1
    Rudre is offline Member
    Join Date
    Jun 2010
    Posts
    2
    Rep Power
    0

    Default 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.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,371
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Rudre View Post
    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.
    Do AIX and HPI recognize the result of the getID() method?

    kind regards,

    Jos

  3. #3
    Rudre is offline Member
    Join Date
    Jun 2010
    Posts
    2
    Rep Power
    0

    Default

    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
    ---------------------------------------------------

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,371
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Rudre View Post
    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
    ---------------------------------------------------
    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

  1. Time Zone Problem on Windows
    By yzaltz in forum New To Java
    Replies: 4
    Last Post: 09-29-2010, 01:38 PM
  2. Replies: 0
    Last Post: 02-22-2010, 01:44 AM
  3. Time zone stamp
    By ddscart in forum New To Java
    Replies: 1
    Last Post: 08-02-2009, 08:41 PM
  4. time Zone
    By mohammedsiddig in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 09-07-2008, 03:38 PM
  5. Replies: 0
    Last Post: 11-06-2007, 02:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •