views:

175

answers:

2

I just noticed something really nice on the Google Analytics signup page for adding a new domain. First you pick a country them you pick your timezone. Instead of showing a huge Timezone list though they populate the timezone list with only timezones that are available for the country you have selected. I think this is a great idea to make picking a timezone easiar for some users.

So I would like to do this with jQuery since most my other javascript is using jquery already. Has anyone seen any existing jquery script that can do this for me? Or possibly how I can figure out what timezones are in each country?

A: 

You can construct the data you want from this table: http://www.datelib.de/Timezones.shtml.en. You would simply group by the Country code column. Probably the best way to go would be to throw all this data into a database table and use some AJAX magic to handle select menu onchange events.

vicatcu
+2  A: 

Can't help with jQuery but for how to figure out what timezones are in each country, you can use DateTimeZone::listIdentifiers() with DateTimeZone::PER_COUNTRY as first argument and the ISO 3166-1 compatible country code as second argument, e.g.

DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, 'GB');

Note: PHP 5.3 is required.

Gordon
Cool I was wondering why I couldn't get it to work, I have 5.2.9 time to upgrade I guess
jasondavis