News Feed
Sections




News Archive
feed this:

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


LaughingMeme.com:
Looking at PHP5's DateTime and DateTimeZone
October 08, 2007 @ 11:14:00

As Martynas Jusevicius points out today, there's a great little look at the new DateTime functionality that's included with PHP5 to make working with dates even simpler.

There is something fundamentally brash, brazen even, to releasing a class named DateTime. [...] I'm going to bump my way through learning how to use this new DateTime lib, bringing all my preconceptions about how it should work. The odds of this being interesting to you is probably nil unless you're in one or two very small cliques, feel free to read on, or browse away.

The article looks at quite a bit of the functionality in the extension - everything from the simple formatting of dates to more complex date object manipulation. A definite read for anyone looking to harness the power of this new functionality.

0 comments voice your opinion now!
php5 datetime datetimezone extension functionality php5 datetime datetimezone extension functionality



Community Events





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


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

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