How to return the time-zone offset in minutes for the current locale?


JavaScript date getTimezoneOffset() method returns the time-zone offset in minutes for the current locale. The time-zone offset is the minutes in difference; the Greenwich Mean Time (GMT) is relative to your local time.

Example

You can try to run the following code to return the time-one offset in minutes −

<html>
   <head>
      <title>JavaScript getTimezoneOffset Method</title>
   </head>
   <body>
      <script>
         var dt = new Date();
         var tz = dt.getTimezoneOffset();
         
         document.write("getTimezoneOffset() : " + tz );
      </script>
   </body>
</html>

Updated on: 23-Jun-2020

193 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements