HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
cancel
Showing results for 
Search instead for 
Did you mean: 

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