开发者

Get timezone off a mobile device?

I'm in the midst of programming a开发者_JS百科 mobile site that should deal with different timezones. Is there a function that gets the timezone off the mobile device? I'm php Zend Framework based.


Precisely because the device is mobile, there is no point in determining the timezone on the server side. Instead, use client-site time.


AFAIK the procedure for getting the timezone from a mobile device is the same as getting it from a desktop client. The mobile browser must support JavaScript or you have to ask for the user to choose and submit their timezone. See this question: How to get client's timezone?


There's no direct way to do this. You can estimate the user's time zone based on his IP address (geolocationing stuff), but that's not really accurate.

Just have a look at most forum scripts how they do it. In general they'll use a small JavaScript to compare server time(zone) and browser time(zone) - but there's no general API or HTTP header field for this.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜