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
Fundamentals
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.
Concept
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.
Foundation
📝 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
Cheat Sheet
⚡ Quick Reference
Goal
Code
Current offset (minutes)
new Date().getTimezoneOffset()
Offset in hours
date.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())
Compare
📋 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
Hands-On
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);
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.
Applications
🚀 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.
Important
📝 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.
Compatibility
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 ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · 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.
Wrap Up
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.
Five things to remember about Date.getTimezoneOffset()
Your foundation for UTC offset reads in JavaScript.
5
Core concepts
📝01
Syntax
date.getTimezoneOffset()
API
🔢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.