File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes timezones for a country Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "timezones for a country" Watch "timezones for a country" New topic
Author

timezones for a country

Hari priya
Ranch Hand

Joined: Mar 11, 2004
Posts: 134

Hi -

Is there a way to get all the timezones that belong to a country in Java? I know there no direct method in the java.util.TimeZone class but wondering if there is a workaround.

Thanks!
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16483
    
    2

No.

What exactly is it you need a "workaround" for?
Hari priya
Ranch Hand

Joined: Mar 11, 2004
Posts: 134


I meant - can we write our own function to do that?

for example -

I tried to get all available timezones and checked if the raw offset falls within a range of US timezones but noticed that it is also returning Mexican timezones.
I tried to parse for the string "America/" but there could other timezone strings that satrt with "America/" that do not belong to US.

Badly need to do this using JDK.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16483
    
    2

Sure you can. You list out all of the possible time zones (there are several hundred of them if I recall right). Then for each of them you write down which countries they apply to. Then you set up some kind of table which encapsulates that information, and have your function access that table.

What I meant was why you needed this information?
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: timezones for a country
 
Similar Threads
GMT to EDT
To extract the timezone from the system
WA #1.....word association
Getting current Time in Groovy
Query regarding timezone