1

I'm in the midst of programming a 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.

Coder
  • 1,917
  • 3
  • 17
  • 33
Darius
  • 75
  • 3
  • 2
    PHP scripts executes on server, not on device. – OZ_ Aug 10 '11 at 09:00
  • possible duplicate of [How to get client's timezone?](http://stackoverflow.com/questions/1905397/how-to-get-clients-timezone) – phihag Aug 10 '11 at 09:08

3 Answers3

0

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?

Community
  • 1
  • 1
JJJ
  • 32,902
  • 20
  • 89
  • 102
  • Also see "Get client timezone (not GMT offset amount) in JS" http://stackoverflow.com/questions/2897478/get-client-timezone-not-gmt-offset-amount-in-js – Doug Domeny Feb 17 '12 at 16:18
0

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

phihag
  • 278,196
  • 72
  • 453
  • 469
0

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.

Mario
  • 35,726
  • 5
  • 62
  • 78