The JavaScript getTimezoneOffset method is one of the date functions that returns the time zone difference between the local time zone and the UTC (Universal Coordinated Time) zone in minutes.
Syntax
The syntax for this JavaScript getTimezoneOffset() function is:
dateObject.getTimezoneOffset()
Return Value: It returns a positive or negative integer value. If the local time zone is behind UTC, it returns a positive value. If the local time is ahead of the UTC zone, it returns a negative value.
The getTimezoneOffset() method finds the difference in minutes between the UTC time zone and the local time zone. Here, local time zone means local system time or the web browser settings, etc. If we use it against an invalid date, it returns NaN.
JavaScript getTimezoneOffset example
In the following JavaScript example, we used the Date() constructor to get the current date. Next, we use the getTimezoneOffset() method to find the difference between the current local time and the UTC time zone offset in minutes.
As we used the PC from India, and the local time zone is 5 hours and 30 Minutes ahead of UTC, it returned negative 330 minutes. 5 Hours 30 Minutes = 330 Minutes.
const dt = new Date();
const tz = dt.getTimezoneOffset();
console.log(tz);
console.log(dt.toString());
-330
Sun Jun 07 2026 12:14:48 GMT+0530 (India Standard Time)
Example 2: We can also use the JavaScript getTimezoneOffset method with a custom date and time to find the difference in minutes. However, as it is the time zone difference, it returns the same result.
const dt = new Date('June 20, 2025');
console.log(dt.getTimezoneOffset());
console.log(dt);
-330
2025-06-19T18:30:00.000Z
Example 3: If we use the getTimezoneOffset() method on an invalid date, it returns NaN. For example, the code below returns NaN because there is no March 32.
const dt = new Date('March 32, 2025');
console.log(dt.getTimezoneOffset());
NaN
Why JavaScript getTimeZoneOffset returns wrong offset?
By default, the gteTimeZoneOffset() method returns the time difference between UTC and local time in minutes.
TimeZoneOffset = UTC Time – Local Time
If you are residing in New York, which is 5 hours behind the UTC zone, the result is 300. The total difference between UTC and New York time = 5 Hours and 5 multiplied by 60 = 300.
When you are residing in India, its time zone is 5 Hours 50 Minutes ahead of UTC, so it returns the negative value of -330.
How to convert getTimeZoneOffset to hours?
Divide the minutes results returned by the getTimeZoneOffset() method by 60 to get the time zone offset difference in hours.
const dt = new Date().getTimezoneOffset();
const tz = dt / 60;
console.log(dt);
console.log(tz);
-330
-5.5