Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830
this week in the
Programmer Certification
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
Liutauras Vilda
Jeanne Boyarsky
paul wheaton
Sheriffs:
Ron McLeod
Devaka Cooray
Henry Wong
Saloon Keepers:
Tim Holloway
Stephan van Hulst
Carey Brown
Tim Moores
Mikalai Zaikin
Bartenders:
Frits Walraven
Forum:
Java in General
To know Timezone given City,State/Province,Country
Maulin Vasavada
Ranch Hand
Posts: 1873
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi all,
I am trying to look for some way to know the following information,
- Given City,State/Province,Country know the Timezone it belongs to at the time of the query
I found following links so far which is a good source of information BUT wanted to get somebody else's input if you have any experience on it.
StackOverflow Post
Thanks
Maulin
John McParland
Ranch Hand
Posts: 92
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi Maulin,
If you look at the
getTimeZone() method of the Calendar class
clearly you can see there is a way to get a TimeZone from a given Calendar.
The trick is to get an appropriate calendar instance using the
getInstance() method of Calendar, passing in a Locale.
Unfortunately that'll not help down to the city level. The above will only work for countries. SO why not try the likes of
Joda Time as suggested here
?
I hope this helps,
John
Passed: SCJP 6 (90%), SCJD 6
Other: Spring training, extensive Swing experience
The only thing that kept the leeches off of me was this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
How to get country name from IP Address
where are you from?
timezone information from zipcode
How to extract country name from IP Address
Can't get my Country name using InetAddressLocator
More...