Javascript - Date getTimezoneOffset() Method

The getTimezoneOffset() method returns the time difference between UTC time and local time, in minutes.

Description

The getTimezoneOffset() method returns the time difference between UTC time and local time, in minutes.

For example, if your time zone is GMT+2, -120 will be returned.

The returned value might change because of Daylight Saving Time.

UTC time is the same as GMT time.

Syntax

Date.getTimezoneOffset()

Parameters

None

Return

A Number, representing the time difference between UTC and Local Time, in minutes

Example

Return the timezone difference between UTC and Local Time:

Demo

//display the timedifference between UTC and local time.
var d = new Date();
var n = d.getTimezoneOffset();
console.log(n);//from   ww  w . j a  v a 2  s.c o  m

Result