Welcome Guest, Not a member yet? Register   Sign In
Timezone Confussion -> convert_to_gmt -> daylight saving zones / Am I right ? Or wrong

Wow .. lengthy. Not that I don't write lengthy posts, just I get confused when other people do Smile

Okay, I'm still digesting this, as I'm about to have a similar problem, and hadn't really cleared up in my mind how I'd approach it (I was still grasping with the best way to record this data and tie it back to my user table). So at the moment I'm a bit in the dark on the best way forward ...

What I do have are a couple of suggestions - one on point, and one not. The latter first. Nothing to worry about with your code - I used to write code like this, and probably still do. I can give you a couple of words of advice there to make your life easier.

Put a blank line above every comment or comment block. It'll make your code look as neat and spacious as everyone else's. Wink

Don't comment things like this, your function name tells you everything you need to know. Just leave a blank line above and beneath it if you want to highlight the profoundly important nature of the command (as opposed to an $x += 5 line Wink .

// now I convert my date to GMT
$gmt_conversion = convert_to_gmt($xy_unix, $event_timezone);

Now, the on point bit. I did start to look into this for my own app a while ago, and then got side-lined by country code (alpha-2) stuff, and hunting down similar sets of data to your timezone web page (I found another of those myself somewhere .. pointed off wikipedia perhaps). Anyhoo, I decided the best thing to do was to pilfer someone else's code, and so I looked around at how others do it. I think the best one (read: most easily comprehensible by me) I found was the approach Moodle uses.

Happily Moodle is GPL (from memory - or at least a close approximation of same).

I'd suggest you have a squizz at how they've done it. Grab the tarball, and specifically check out:
/lib/timezones.txt     // this has its formatting listed at the top, and is 1940 lines long!  example follows:

Their /lang/en_utf8/timezones.php seems to be a much shorter version of similar information, but haven't looked into that. The interesting files for you and me are going to be /admin/timezoneimport.php and /admin/timezone.php

Anyhoo, have a look through those to see if they're of any help while I ponder, albeit apparently quite sedately, on the greater issue of resolving bugs with DST handling.

Messages In This Thread
Timezone Confussion -> convert_to_gmt -> daylight saving zones / Am I right ? Or wrong - by El Forum - 06-17-2009, 02:59 PM

Theme © iAndrew 2016 - Forum software by © MyBB