How to get the client timezone offset in JavaScript? Last Updated : 30 Apr, 2019 Comments Improve Suggest changes Like Article Like Report 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. Syntax: offset = new Date().getTimezoneOffset() Example: html <!DOCTYPE html> <html> <head> <title> How to get the client timezone offset in JavaScript? </title> </head> <body> <h1 style="color: green"> GeeksForGeeks </h1> <b> How to get the client timezone offset in JavaScript? </b> <p> Click on the button to get the timezone offset </p> <p>Output: <span class="output"></span></p> <button onclick="getTimezone()"> Get timezone </button> <!-- Script to get the client timezone --> <script type="text/javascript"> function getTimezone() { offset = new Date().getTimezoneOffset(); formatted = -(offset / 60); document.querySelector('.output').textContent = formatted; } </script> </body> </html> Output: Before clicking the button: After clicking the button: Comment More infoAdvertise with us Next Article How to get the client timezone offset in JavaScript? S sayantanm19 Follow Improve Article Tags : JavaScript Web Technologies jQuery-Misc Similar Reads How to set timezone offset using JavaScript ? The timezone offset represents the difference in minutes between local time and Coordinated Universal Time (UTC). Here are two different ways to set the timezone offset in JavaScript.1. Using getTimezoneOffset() MethodThe getTimezoneOffset() method is used to find the timezone offset. It returns the 2 min read How to get JavaScript Date in UTC using MomentJS? When working with dates and times in JavaScript, especially in applications that deal with users across different time zones, it is often necessary to work with dates in UTC (Coordinated Universal Time). Below are the approaches to get a date in UTC using Moment.js:Table of ContentUsing moment().utc 2 min read How to get seconds since epoch in JavaScript? Given a date, we have to find the number of seconds since the epoch (i.e. 1 January 1970, 00:00:00 UTC ). The getTime() method in the JavaScript returns the number of milliseconds since January 1, 1970, or epoch. If we divide these milliseconds by 1000 and then integer part will give us the number o 1 min read How to Convert Date to Another Timezone in JavaScript? Converting a date to another timezone in JavaScript means adjusting the local date and time to match the time in a different timezone. This ensures that the displayed time aligns with the selected timezone, often using built-in methods or external libraries.1. Using Intl.DateTimeFormat() and format( 2 min read JavaScript Get the start and end of the day in UTC Given a date, and the task is to determine the start and end of the day of the date using JavaScript. We're going to discuss a few methods. These are: JavaScript setHours() Method: This method sets the hour of a date object. This method can be used to set the minutes, seconds, and milliseconds. Synt 3 min read Like