Getting Olson time zone name

Hello,

Could someone help and tell me how do I get Olson time zone name in Java application? I.e. I need to get the name in format like MST7MDT or PST8PDT etc.

I tried something in vein of:

TimeZone.getDefault().getDisplayName(true,

TimeZone.SHORT);

but it produces only 3-letter, deprecated name. Any clues? Thanks!

[354 byte] By [konradgarusa] at [2007-11-26 21:38:01]
# 1
The getID() method is what you are looking for:TimeZone tz = TimeZone.getTimeZone("PST8PDT");System.out.println(tz.getID());
DrClapa at 2007-7-10 3:20:42 > top of Java-index,Java Essentials,Java Programming...
# 2

Thank you. It does work in your example, but how to determine what zone is the system in? Should I know the name of the zone, I wouldn't need to ask.

System.out.println(TimeZone.getDefault().getID());

System.out.println(TimeZone.getTimeZone("PST8PDT").getID());

System.out.println(TimeZone.getDefault().hasSameRules(TimeZone.getTimeZone("PST8PDT")));

Produces:

America/Los_Angeles

PST8PDT

false

konradgarusa at 2007-7-10 3:20:42 > top of Java-index,Java Essentials,Java Programming...
# 3
How to determine what time zone the system is in? That's what the TimeZone.getDefault() method does. I'm not sure what you are getting at here or why you are fixated on PST8PDT.
DrClapa at 2007-7-10 3:20:42 > top of Java-index,Java Essentials,Java Programming...