开发者

How to get country details from timezone?

How can I find coun开发者_Go百科try details from time zone using php.


You know user's time zone and want to know where he is from? You can't do that, because, obviously, there is (alot) more than one country within one time zone.

If you want to find out the location of a user, use his ip, or geolocation.


You can make a map from the timezone name to country. But that only works if the are using zt-type names, ie Europe/Paris, and not if they use Windows insane names like "Romance Standard Time", nor if they use abbreviations like CET or the offset like +01:00. as these are not country-unique.

And even if you are on Unix, and you want to figure out the timezone name, you are out of luck. You can't do that reliably. So your user might have to select the timezone manually.

And in that case he can just as well select his country manually in the first place.

In short: There are way better to figure out a users country name than via the timezone. Try to give some context to the question. Is this via the web? Using php indicates this, but then how the heck do you know the users timezone!? :-)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜