Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

How to get the client timezone offset in JavaScript?

  • Last Updated : 30 Apr, 2019

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()


<!DOCTYPE html>
        How to get the client timezone
        offset in JavaScript?
    <h1 style="color: green">
        How to get the client timezone
        offset in JavaScript?
        Click on the button to get
        the timezone offset
    <p>Output: <span class="output"></span></p>
    <button onclick="getTimezone()">
        Get timezone
    <!-- Script to get the client timezone -->
    <script type="text/javascript">
        function getTimezone() {
            offset = new Date().getTimezoneOffset();
            formatted = -(offset / 60);
                    = formatted;


  • Before clicking the button: before-click
  • After clicking the button: after-click

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!