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 @ 16: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).

tagged: timezone latitude longitude googlemaps geonames datetimezone

Link:

LaughingMeme.com:
Looking at PHP5’s DateTime and DateTimeZone
Oct 08, 2007 @ 16: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.

tagged: php5 datetime datetimezone extension functionality php5 datetime datetimezone extension functionality

Link:

LaughingMeme.com:
Looking at PHP5’s DateTime and DateTimeZone
Oct 08, 2007 @ 16: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.

tagged: php5 datetime datetimezone extension functionality php5 datetime datetimezone extension functionality

Link:


Trending Topics: