News Feed
Jobs Feed
Sections




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 GeoNames.org. 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

Ivo Jansch's Blog: My First Mashup

Vancouver Web Consultants Blog: Getting Time Zone from Latitude & Longitude

Internet.com: Plotting Map Markers Dynamically Using the Google Maps API, jQuery, PHP, and MySQL

EasyPHPWebsites.com: Creating a Website Visitor Map (Ajax, jQuery, Google Maps API)

PHPClasses.org Blog: Locating addresses on Google Maps embedded in PHP generated Web forms


Community Events











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


introduction dependency component opinion security hack unittest release framework language series composer install package podcast application overview hhvm symfony2 facebook

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework