doushiposong30622
2010-01-25 22:34
浏览 183

使用每个国家/地区的可用时区填充时区下拉列表?

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?

图片转代码服务由CSDN问答提供 功能建议

我刚刚在Google Analytics注册页面上发现了一些非常好的内容,用于添加新域名。 首先,你选择一个国家,你选择你的时区。 虽然他们只使用可供您选择的国家/地区使用的时区填充时区列表,但不会显示巨大的时区列表。 我认为,为一些用户选择一个时区是个好主意。

所以我想用jQuery做这个,因为我的大多数其他javascript已经使用了jquery。 有没有人看到任何现有的jquery脚本可以为我做这个? 或者可能我如何弄清楚每个国家/地区的时区是什么?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • douwei4370 2010-01-25 22:49
    已采纳

    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.

    已采纳该答案
    打赏 评论
  • dtlzdofl66441 2010-01-25 22:41

    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.

    打赏 评论

相关推荐 更多相似问题