This question already has an answer here:
Is there a way get the timezone of a user by their latitude and longitude? And not just the offset, but the actual timezone they're in.
Essentially, I'm searching for the polar opposite of DateTimeZone::getLocation which returns the latitude and longitude for a certain timezone.
The Yahoo places API provides timezone information via reverse geolocation.
Check it out.
http://developer.yahoo.com/geo/placefinder/guide/requests.html
What about google time zone api
https://developers.google.com/maps/documentation/timezone/
it takes
latitude
andlongitude
and returns array like thisbut there are some limits
For those who wants to get timezone from country code, latitude and longitude. ( easy to get it if you have a geoip module installed on your server )
Try this, I've added a distance calculation - only for those countries which has multiple timezones. Ah, and the country code is a two letter ISO code.
I did a timezone solution recently in an 8 hour long hackathon. It's quickly put together and I'd love to develop it further and sell it as a product but since there is no way for me to do it, I've open sourced it at my github.
There is a demo too but it may go down if it hits resource limits. It's a free webapp on Google App Engine.
You can definitely optimize/augment this further in wrt - running time, space, data - to suit your needs.
How about finding the closest point to the one in the list of all timezone locations? I wonder how accurate is this?
UPDATE: Eventually, I came up with this snippet that works for me. This will work fine for all locations, but may not be accurate for those close to borders.
Geonames should do the job nicely:
http://www.geonames.org/
They've also got a php library.