Operating System - HP-UX
1827672 Members
3318 Online
109967 Solutions
New Discussion

Re: How to determine TZ in java

 
SOLVED
Go to solution
frederick hannah
Super Advisor

How to determine TZ in java

I have several versions of java installed on my RP7400, 11.11 server. What is the most reliable way of confirming which TZ each java version is using?
4 REPLIES 4
Andrew C Fieldsend
Respected Contributor
Solution

Re: How to determine TZ in java

The time zone is a property of the running process, not the application, taken from the TZ environment variable. You can run the same executable in multiple time zones simultaneously, just by changing the environment before starting the process.

If you haven't changed the environment (possibly in a wrapper script) before running the executable, they will all have the same TZ.
frederick hannah
Super Advisor

Re: How to determine TZ in java

Thanks. That is very helpful.
Bill Hassell
Honored Contributor

Re: How to determine TZ in java

Unfortunately, not all versions of Java use the HP-UX timezone information. A Google search:

java timezone tz

reveals a number of exceptions. It would be nice if all Java versions used the standard date/time routines from the OS, but that's the nice thing about standards -- there so many to choose from...

http://www.javaworld.com/javaworld/jw-12-2006/jw-1201-dst.html

See also HP's Java website:

www.hp.com/go/java


Bill Hassell, sysadmin
Andrew C Fieldsend
Respected Contributor

Re: How to determine TZ in java

Actually, no version of Java since 1.4 uses the OS routines for handling time zones; support for the (built-in) zoneinfo database is part of the standard java.util.TimeZone class.

All versions identify the defaut time zone from the (platform-dependent) environment, but the system TZ name may not be recognised as the naming convention is different (in which case it defaults to GMT). Depends on how the application was written, of course.

As you say, aren't standards wonderful...