rpatidar
By:
rpatidar

How to get client browser timezone at server end php?

April 21, 2017 918 views
PHP JavaScript

I want to know client side browser timezone at my server and php so i can show user timezone datetime from utc.

1 Answer

@rpatidar

There's a few options, though there's not a PHP Class or Function that will automatically do it for you.

GeoIP

Use GeoIP and location-based matching to match the IP to a zone. The downside here, as with many solutions, is that if they are using a VPN or Proxy, it will show the zone of the VPN or Proxy IP, not the users physical IP that's behind it.

User Data

Have the user provide their timezone and you can do conversions against GMT.

Javascript

Javascript is client-side, though much like GeoIP, if the client is behind a VPN or Proxy, the same issue persists. You won't be displaying the timezone of the user, you'll be displaying the timezone of the VPN or Proxy.

Have another answer? Share your knowledge.