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.
精彩评论