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:
- How to get rid of an element offset using CSS ?
- How to get the MAC and IP address of a connected client in PHP?
- How to generate a drop down list of timezone using PHP ?
- How to create a date with a set timezone without using a string representation?
- jQuery | offset() with Examples
- CSS | outline-offset Property
- What is the difference between position() and offset() in jQuery ?
- How to avoid undefined offset error in PHP ?
- How to set the offset property for ScrollSpy in Bootstrap ?
- Server side and Client side Programming
- PHP | Determining Client IP Address
- Client-Server Model
- How to set alternate content for users that do not support client-side scripts ?
- HTTP status codes | Client Error Responses
- How to create a client-side image-map in HTML5 ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.