The client’s timezone offset could be detected by using the Date object’s getTimezoneOffset() method.
The getTimezoneOffset() method returns the time difference between UTC time and local time, that is the time offset, in minutes. This offset is changed by dividing by 60 and negating the result.
Note: The getTimezoneOffset() does not account for Daylight Savings, therefore this value may not be constant.
offset = new Date().getTimezoneOffset()
- Before clicking the button:
- After clicking the button:
- jQuery | offset() with Examples
- CSS | outline-offset Property
- How to generate a drop down list of timezone using PHP ?
- PHP | Determining Client IP Address
- How to get the MAC and IP address of a connected client in PHP?
- Server side and Client side Programming
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.