| Author |
How to get country name for a particluar TimeZone object??
|
sujay bawaskar
Greenhorn
Joined: Mar 19, 2009
Posts: 7
|
|
Hi
I need to develope a website which shows the client time and the client timezone. I get the Locale of client and time zone offset from javascript but I am not able to obtain exact time zone of client as an offset has multiple time zones. Please help me on this.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
What is your exact question? Your subject line is not related to your actual post.
The answer to the question in your subject line is simple: you can't. The reason is quite clear: a time zone does not have a specific country; many time zones are used in multiple countries. For instance, CET spans half of Europe.
About your second question: you say you have the offset, right? You can then create an instance of SimpleTimeZone using that offset.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
sujay bawaskar
Greenhorn
Joined: Mar 19, 2009
Posts: 7
|
|
|
That is the problem only, one Time zone offset spans over multiple timezone, hence i am not able to get exact timezone for my client side. If i get country for that timezone then i can figure it out.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
No you can't. Two good examples: the United States and Russia both span multiple time zones. In the end, there is a many-to-many relation between countries and time zones: a time zone can span multiple countries, and a country can span multiple time zones. The only way to get the correct time zone is to know the exact location; that is, the longitude and latitude. Some time zones do not run in parallel with meridians, so only the longitude is not enough.
|
 |
sujay bawaskar
Greenhorn
Joined: Mar 19, 2009
Posts: 7
|
|
|
Thanks for your reply.
|
 |
 |
|
|
subject: How to get country name for a particluar TimeZone object??
|
|
|