JavaScript Date getTimezoneOffset() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Date

Definition

Date.prototype.getTimezoneOffset() returns the difference, in minutes, between this date in UTC and in the local timezone of the host (MDN). It is read-only and does not change the Date.

Remember
date.getTimezoneOffset()

→ minutes: UTC − local
→ NaN if the Date is invalid

Examples (MDN-style):
  UTC−8  →  480
  UTC    →    0
  UTC+3  → -180
  UTC+5:30 (India) → -330

Not the GMT offset written in a date string —
always the host local offset for that instant.

Syntax

Call date.getTimezoneOffset. Start with this line.

JavaScript
date.getTimezoneOffset()
CallWhat it does
date.getTimezoneOffset()Primary signature.
date.getTimezoneOffset(...)Call with the arguments your case needs.

Built into JavaScript. Call getTimezoneOffset(...) on a Date instance — no import required.

Library declarations
JavaScript
date.getTimezoneOffset()

Parameters

This method has no parameters beyond those shown in the signature.

Return Value

Return ValueDescription
*Minutes: UTC − local

JavaScript Examples

Example 1 — Read the Local Offset

MDN: different GMT strings still share the same host offset.

JavaScript
const date1 = new Date("August 19, 1975 23:15:30 GMT+07:00");
const date2 = new Date("August 19, 1975 23:15:30 GMT-02:00");

console.log(date1.getTimezoneOffset()); // your local offset (e.g. -330)
console.log(date1.getTimezoneOffset() === date2.getTimezoneOffset()); // true
Try It Yourself

How It Works

  1. Two strings. The GMT parts differ, but both create valid instants.
  2. Same host rule. getTimezoneOffset() uses your local timezone for that instant — not the GMT in the string.
  3. Equal. Both calls return the same minutes → true.
  4. Value. On this machine the minutes may be -330, 0, 300, etc.

Example 2 — Format a UTC±HH:MM Label

Flip the sign to build a familiar offset label for display.

JavaScript
function utcLabel(date) {
  const mins = -date.getTimezoneOffset(); // flip for display
  const sign = mins >= 0 ? "+" : "-";
  const abs = Math.abs(mins);
  const h = String(Math.floor(abs / 60)).padStart(2, "0");
  const m = String(abs % 60).padStart(2, "0");
  return "UTC" + sign + h + ":" + m;
}

console.log(new Date().getTimezoneOffset()); // e.g. -330
console.log(utcLabel(new Date()));           // e.g. "UTC+05:30"
Try It Yourself

How It Works

  1. Flip. Negate the minutes so ahead-of-UTC zones become positive for the label.
  2. Sign. Choose "+" or "-" from the flipped value.
  3. Split. Hours = floor(abs / 60); minutes = abs % 60; pad both.
  4. Join. Build UTC±HH:MM for UI or logs.

Example 3 — DST Can Change the Offset

In DST regions, winter and summer dates may return different minutes (MDN).

JavaScript
const winter = new Date("2022-02-01").getTimezoneOffset();
const summer = new Date("2022-08-01").getTimezoneOffset();

console.log(winter); // e.g. 300 in New York (UTC−5)
console.log(summer); // e.g. 240 in New York (UTC−4)
console.log(winter === summer); // true if no DST; false if DST applies
Try It Yourself

How It Works

  1. Two dates. February and August sample different seasons.
  2. DST zones. Offsets can shrink in summer (e.g. 300 → 240 in New York).
  3. No-DST zones. Both calls match → true (e.g. India year-round).
  4. Rule. Always call getTimezoneOffset() on the specific date you care about.

Browser & Runtime Support

Date.prototype.getTimezoneOffset() is part of the language from early ECMAScript and is Baseline Widely available (MDN).

✓ Baseline · Widely available

Date.prototype.getTimezoneOffset()

Supported in every modern browser and Node.js. No polyfill needed for ordinary web apps.

99% Modern browser support
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
Date.getTimezoneOffset() Excellent

Bottom line: Safe everywhere. Focus on the inverted sign, DST, and invalid-Date checks rather than feature detection.

Frequently Asked Questions

The difference in minutes between this date in UTC and in the local timezone (host system). Positive means local time is behind UTC; negative means local is ahead of UTC. Invalid Dates return NaN.
It returns UTC − local in minutes. UTC+5:30 (India) yields −330. UTC−8 yields +480. It is not the same sign as a UTC± label.
No. MDN: two Dates built with different GMT offsets still return the same getTimezoneOffset() — the host local offset for that instant, not the offset written in the string.
Yes. In DST regions the minutes can differ for summer vs winter dates. Only the Date’s instant matters, not when you run the code.
NaN. Validate with Number.isNaN(date.getTime()) first.
getTimezoneOffset() only returns minutes. Prefer Intl.DateTimeFormat().resolvedOptions().timeZone for an IANA zone name.

Next: getUTCDate()

Learn how to read the day of the month in UTC (1–31) from a Date.

getUTCDate() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

11 people found this page helpful