By rpatidar
I want to know client side browser timezone at my server and php so i can show user timezone datetime from utc.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Download and store countries and timezones in database.
get client IP address in PHP
then Get Country name
Search timezone in database
Full solution : https://www.edanesh.com/article/How-to-detect-users-timezone-in-php
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.