The task:
Time zone chooser widget that allows site visitors to choose their time zone should be generated and populated with reasonable data. It should offer choices like this:
GMT-11 (HH:MM actual time in that zone)
GMT-10 (...)
GMT-1 (...)
... now for the tricky part:
GMT (...)
GMT+1 (...)
... and then all the way until +12.
When user chooses different time zone, server should be able to figure out what time zone to set. This second part isn't much of a problem, once list is populated with correct data.
The problem:
Tricky part is getting actual timezones which are currently in use world-wide. I know how to get entire list of timezones, and how to get their offsets and current DST settings. But, each time zone has two variants: regular time and DST time.
In above list I have marked certain "tricky" part. This is where time zones like Europe/London are. During regular time, Europe/London = GMT, but during DST, Europe/London = GMT+1... Can you see a problem?
What troubles me also is that not all time zones change from DST to regular time and vice-versa, so I can't just populate list with generic data like -11 = GMT-11, -10 = GMT-10, ... and then just apply some logic to locate time zone with appropriate time difference and then set that time zone as a default from that point on.
I'm interested to hear how other sites, that utilize this time zone switching feature, come up with a list of time zones and a logic to choose right time zone, depending on user's choices? Something else you'd like to add or ask?