News Feed

News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Vancouver Web Consultants Blog:
Getting Time Zone from Latitude & Longitude
May 08, 2009 @ 11:15:30

On the Vancouver Web Consultants blog there's this new tutorial about grabbing latitude and longitude information for a location and determining its current time zone from there.

I was recently tasked with building an application that relied heavily on accurate time zone conversions. I, like many people I soon found out, thought there were just a handful of timezones and the usual select list would suffice. The deeper I looked into the problem, the deeper it got: the list above only shows a few time offsets from UTC, but it doesn't tell me, beyond a shadow of a doubt, exactly what time it is where the user is situated, nor can I rely on that time for calculations in the future. The fact is, here are a LOT of timezones in the world.

He came across the DateTimeZone class PHP has to offer and was happy to see it met his needs. Unfortunately, users weren't always sure what timezone they were in, so he came up with a system combining Google's Maps API and He includes the code for both the PHP and Javascript sides (the Javascript requires Mootools, but it could be easily adapted to any other Javascript libraries).

1 comment voice your opinion now!
timezone latitude longitude googlemaps geonames datetimezone

blog comments powered by Disqus

Similar Posts

Gary Sieling: Scraping Google Maps Search Results with Javascript and PHP

Joakim Nygard's Blog: Timezones in MySQL and PHP

PHP-GTK Community Site: Locating PHP-GTK developers

Christopher Jones' Blog: Location Awareness With Oracle Spatial in PHP Timezones, the Right Way

Community Events

Don't see your event here?
Let us know!

framework community introduction testing api laravel part2 podcast list php7 application interview yii2 opinion composer symfony series example language project

All content copyright, 2015 :: - Powered by the Solar PHP Framework