| 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
|
|
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
|
|
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?
|
 |
 |
|
|
subject: timezones for a country
|
|
|