JavaScript Date getTimezoneOffset() Method

Beginner
⏱️ 9 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
UTC offset (min)

What You’ll Learn

getTimezoneOffset() returns how many minutes local time differs from UTC for a given Date. This guide covers syntax, the inverted sign, five examples, DST notes, and when to prefer modern Intl APIs.

01

Syntax

date.getTimezoneOffset()

02

Unit

Minutes

03

Sign

UTC − local

04

+ behind

− ahead

05

Format

UTC±HH:MM

06

DST

Changes offset

Introduction

Global apps must translate instants into local clocks. The getTimezoneOffset() method tells you how far the user’s timezone is from UTC—in minutes—for a specific Date value.

It does not return a timezone name like "Asia/Kolkata". For named zones in modern code, use Intl.DateTimeFormat().resolvedOptions().timeZone.

Understanding the getTimezoneOffset() Method

Date.prototype.getTimezoneOffset() is a zero-argument instance method. It returns (UTC time − local time) expressed in minutes for the same instant.

That inverted sign trips up beginners: if you are in UTC+5:30, local is ahead of UTC, so the result is negative (typically -330). If you are in UTC−5, local is behind UTC, so the result is positive (typically 300).

💡
Beginner Tip

Memory hook: positive offset → you are behind UTC. Negative offset → you are ahead of UTC.

📝 Syntax

JavaScript
dateObj.getTimezoneOffset()

Parameters

  • None.

Return value

  • Integer minutes for a valid Date (can be negative).
  • NaN if dateObj is invalid.

Sign examples

  • UTC+5:30 (India) → usually -330
  • UTC+0 (London, standard time) → 0
  • UTC−5 (US Eastern, standard time) → usually 300

⚡ Quick Reference

GoalCode
Current offset (minutes)new Date().getTimezoneOffset()
Offset in hoursdate.getTimezoneOffset() / 60
Local ahead of UTC?date.getTimezoneOffset() < 0
Local behind UTC?date.getTimezoneOffset() > 0
Named timezone (modern)Intl.DateTimeFormat().resolvedOptions().timeZone
Valid date check!Number.isNaN(date.getTime())

📋 getTimezoneOffset() vs Related APIs

Use the right tool for numeric offsets, named zones, or UTC component reads.

getTimezoneOffset()
± minutes

UTC − local

Intl timeZone
"Asia/…"

IANA name

getUTCHours()
0–23

UTC hour part

toISOString()
…Z

UTC string

Examples Gallery

Open DevTools Console (F12) or use Try-it links. Offset values depend on your machine’s timezone and DST rules.

📚 Getting Started

Read the offset in minutes from the current time.

Example 1 — Get the Current Timezone Offset

Call getTimezoneOffset() on new Date().

JavaScript
const now = new Date();
const offsetMinutes = now.getTimezoneOffset();

console.log("Offset (minutes):", offsetMinutes);
Try It Yourself

How It Works

The number reflects your OS timezone at this instant. It is not a timezone name—only the minute difference from UTC with the inverted sign.

📈 Practical Patterns

Sign checks, hour conversion, labels, and UTC comparison.

Example 2 — Check Whether Local Time Is Ahead of UTC

A negative offset means local clocks run ahead of UTC.

JavaScript
const offset = new Date().getTimezoneOffset();
const isAheadOfUtc = offset < 0;
const isBehindUtc = offset > 0;

console.log("Ahead of UTC:", isAheadOfUtc);
console.log("Behind UTC:", isBehindUtc);
Try It Yourself

How It Works

Do not flip the sign mentally when comparing—the method already returns UTC minus local. Negative means local is greater (ahead).

Example 3 — Convert the Offset to Hours

Divide by 60 for a decimal hour value (e.g. −5.5 for UTC+5:30).

JavaScript
const offsetHours = new Date().getTimezoneOffset() / 60;

console.log("Offset (hours):", offsetHours);
Try It Yourself

How It Works

To display a human label like UTC+5:30, negate the offset first: local offset hours = -getTimezoneOffset() / 60.

Example 4 — Format a UTC±HH:MM Label

Build a readable offset string from minutes.

JavaScript
function formatUtcOffset(date) {
  const offsetMin = date.getTimezoneOffset();
  const sign = offsetMin <= 0 ? "+" : "-";
  const abs = Math.abs(offsetMin);
  const hours = String(Math.floor(abs / 60)).padStart(2, "0");
  const mins = String(abs % 60).padStart(2, "0");
  return "UTC" + sign + hours + ":" + mins;
}

console.log(formatUtcOffset(new Date()));
Try It Yourself

How It Works

The helper flips the sign for display labels. Production apps often prefer Intl.DateTimeFormat with timeZoneName: "shortOffset" when available.

Example 5 — Compare Local and UTC Hours on the Same Instant

See how getHours() and getUTCHours() differ for one moment.

JavaScript
const date = new Date();

console.log("Local hour:", date.getHours());
console.log("UTC hour:", date.getUTCHours());
console.log("Offset (min):", date.getTimezoneOffset());
Try It Yourself

How It Works

The gap between local and UTC component getters reflects your offset. For storage and APIs, keep instants as UTC ISO strings or epoch ms; convert to local only in the UI.

🚀 Common Use Cases

  • Meeting labels — show UTC± offset beside local time.
  • Debug panels — log client offset with error reports.
  • Legacy math — adjust timestamps when only offset minutes are known.
  • Form hints — explain why UTC pickers differ from local display.
  • Analytics — bucket users by offset at event time.
  • Education — teach UTC vs local before using Intl.

🧠 How getTimezoneOffset() Is Computed

1

Instant

Date stores one moment as UTC milliseconds.

Storage
2

Local vs UTC parts

Engine derives local and UTC field values.

Compare
3

Minute delta

Return (UTC − local) in minutes.

Offset
4

Display or math

Format labels or pair with UTC getters.

📝 Notes

  • Sign is inverted: positive = behind UTC, negative = ahead.
  • Result is in minutes, not hours (divide by 60).
  • DST transitions can change the offset for the same calendar date next year.
  • Invalid dates return NaN.
  • Prefer Intl and IANA zone names for new scheduling features.
  • Do not manually subtract offset from getTime() to “get local time”—the Date already represents the instant; format it instead.

Browser & Runtime Support

Date.prototype.getTimezoneOffset() has been available since the first JavaScript Date implementation (ES1). It works in every browser and Node.js.

Baseline · ES1

Date.prototype.getTimezoneOffset()

Supported in Chrome, Firefox, Safari, Edge, Internet Explorer, and all Node.js versions. No polyfill required.

99% Universal API
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. Pair with Intl for named zones; remember the inverted sign when formatting UTC± labels.

Conclusion

getTimezoneOffset() returns the minute difference between UTC and local time with an inverted sign. Use it to understand client offsets; prefer Intl for named zones and UTC storage for server data.

Next, learn getUTCDate() for the UTC day-of-month, or toISOString() for UTC strings.

💡 Best Practices

✅ Do

  • Remember positive = behind UTC
  • Convert minutes to hours with / 60
  • Account for DST on the specific Date
  • Store UTC on servers; show local in UI
  • Use Intl for zone names in new code

❌ Don’t

  • Assume negative means behind UTC
  • Confuse offset minutes with getTime()
  • Hard-code offsets for global users
  • Shift getTime() manually for display
  • Ignore DST when scheduling recurring events

Key Takeaways

Knowledge Unlocked

Five things to remember about Date.getTimezoneOffset()

Your foundation for UTC offset reads in JavaScript.

5
Core concepts
🔢 02

Minutes

Not hours.

Unit
🌐 03

Sign flip

UTC − local.

Pitfall
📅 04

DST

Offset shifts.

Calendar
05

Use Intl

Zone names.

Modern

❓ Frequently Asked Questions

The difference in minutes between UTC and the Date's local time, as returned by the runtime timezone. The value uses an inverted sign: positive means local time is behind UTC; negative means local time is ahead of UTC.
It returns (UTC − local) in minutes, not (local − UTC). UTC+5:30 (India) yields −330, not +330. UTC−5 (US Eastern standard) yields +300.
Yes. The offset reflects the rules active on that specific Date instant, so it can change when DST starts or ends in the local timezone.
getTimezoneOffset() returns only a numeric minute offset for one instant. Intl.DateTimeFormat().resolvedOptions().timeZone gives a named zone like 'Asia/Kolkata'—prefer Intl for modern apps when you need IANA zone names.
NaN. Validate with Number.isNaN(date.getTime()) first.
const hours = date.getTimezoneOffset() / 60; Remember the sign: negative hours mean local is ahead of UTC (e.g. −5.5 for UTC+5:30).
Did you know?

UTC+5:30 returns -330, not +330, because getTimezoneOffset() computes UTC minus local. When showing a label like UTC+05:30, flip the sign for humans.

Continue to getUTCDate()

Learn how to read the UTC day-of-month from a Date object.

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.

6 people found this page helpful