开发者

matching timezone to a specifc time range in php

I'm trying to figure out a way in php to give a time range (say 1pm-1:59pm) and return a timezone/loc开发者_开发百科ation where that is the current time. Any ideas?


Calculate how many hours that is from the current time (represent the time in seconds, use time to get the current time, subtract). You know the GMT offset of your current location (and your server knows it, date can give it to you). Subtract again and you know the GMT offset of the time. Now you just need a map of GMT offsets to time zones, which you can easily pull out of Wikipedia; there will be multiple time zone names for most offsets.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜