JavaScript Date getTimezoneOffset()
Example
Get the difference between UTC time and local time:
let diff = d.getTimezoneOffset();
Description
getTimezoneOffset()
returns the difference between UTC time and local time.
getTimezoneOffset()
returns the difference in minutes.
For example, if your time zone is GMT+2, -120 will be returned.
Notes
The value is not constant because of varying Daylight Saving Time.
The Universal Time Coordinated (UTC) is the time set by the World Time Standard.
UTC time is the same as GMT (Greenwich Mean Time).
Syntax
Parameters
Return Value
Browser Support
getTimezoneOffset()
is an ECMAScript1 (JavaScript 1997) feature.
It is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |