Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript getTimezoneOffset() Method

JavaScript getTimezoneOffset() Method

Date Object Reference JavaScript Date object

Example

Return the time difference between Greenwich Mean Time and local time:

var d = new Date()

var n = d.getTimezoneOffset();

n Output result:

Try it »


Definition and Usage

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

For example, if the time zone is GMT+2, it returns -120.

Note: Because of daylight saving time conventions, the return value of this method is not a constant.

**Tip:** Coordinated Universal Time, also known as Universal Time, World Standard Time, or International Coordinated Time, abbreviated as UTC (Universal Coordinated Time).

**Note:** UTC time is the same as GMT (Greenwich) time.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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

Date Object Reference JavaScript Date object