On Sun, Dec 08, 2002 at 05:17:19PM +0000, Tamsin wrote:Does anyone know how I'd go about finding out the time zone offset for a given time zone name?Yes, there have been mine & Mark's solution. What do you need it for?
Yep, I've got the data I want now! I am surprised however that no ones written a neat little module to do this...
I have a silly weather website - weatherpixie.com. People keep mailing me and asking me why I can't put local time on there cos its really easy to do (ha!). So I'm doing this because I'm fed up with explaining to people that its not actually that easy and have better things to do than to work out the time zones for 6000 places for which I only have a longitude and latitude and a place name that may or may not match with other place name/time zone databases..... So basically I'm doing this to stop an extremely helpful Belgian mailing me with links to windows .exe files that tell you time zones for places...
What I suspect I'm going to do is make a a Perl script that runs 1/2 hourly orDoes the info need to stay extremely current? If not, you could just batch process the results and get a list of places & offsets rather than polluting your code employing some horrid hack in real time.
hourly and gets the offsets for all the times zones I use. It'll then write those
out to a MySQL table with the offset in either hours or seconds and perhaps
the abbreviation code too. I can then use this in PHP to work out the
local time for each location as and when I need it...
Long term the plan is to make Perl parse the weather data so I will probably write
the local time out with the parsed weather data....
Its not a complete disaster if its wrong, it would just be nice to do the
time of reading and sunset/sunrise in local time as well as GMT... I'm guessing
I probably don't need to do it every half hour, but I suspect if I don't I'll run into
issues where the clocks have gone back/forward somewhere and my code
doesn't catch up till the next day....
T.
--
The future's bright, the future's orange!
http://www.tamsin.com