News 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

Builder.com.au: Get the correct time by converting between time zones with PHP and PEAR

PHP-GTK Community Site: Locating PHP-GTK developers

Chris Risner: Mobile Geolocation Apps with Windows Azure Websites Part 1: The PHP Code

Etsy Code as Craft: There and Back Again: Migrating Geolocation Data to GeoNames

Hasin Hayder's Blog: WorldTimeEngine - How about making your own in PHP?


Community Events





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


community update laravel composer library framework opinion release language mvc tool voicesoftheelephpant series symfony package introduction podcast security version interview

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