JavaScript getTimezoneOffset()Method
Examples
Returns the difference between Greenwich Mean Time and local time:
var d = new Date()
var n = d.getTimezoneOffset();
var n = d.getTimezoneOffset();
nOutput:
Try it yourself »
Definition and Usage
The getTimezoneOffset() method returns the difference between Greenwich Mean Time and local time, in minutes.
For example, if the time zone is GMT+2, it will return -120.
Note:Due to the practice of using daylight saving time, the return value of this method is not a constant.
Tip:Coordinated Universal Time, also known as Universal Coordinated Time, World Standard Time, International Coordinated Time, abbreviated as UTC (Universal Coordinated Time).
Note:UTC time is the same as GMT (Greenwich) time.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the getTimezoneOffset() method.
Syntax
Date.getTimezoneOffset()
Return Value
| Type | Description |
|---|---|
| Number | The time difference between local time and GMT time, in minutes. |
Technical Details
| JavaScript Version: | 1.0 |
|---|
Other Extensions
JavaScript Date Object