News Feed
Jobs Feed
Sections




News Archive
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

Websanova.com: Timezones, the Right Way

PHPMaster.com: Targeted Geolocation with Geonames

Sameer Borate's Blog: Geographical information lookup using GeoNames

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


Community Events









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


tool release testing api composer zendframework2 development community object interview language framework example event introduction functional podcast database code opinion

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