ES6 - getTimezoneOffset() Method



Javascript date getTimezoneOffset() method returns the time-zone offset in minutes for the current locale. The time-zone offset is the minutes in difference, the Greenwich Mean Time (GMT) is relative to your local time.

For example, if your time zone is GMT+10, -600 will be returned. Daylight savings time prevents this value from being a constant.

Syntax

Date.getTimezoneOffset()   

Return Value

Returns the time-zone offset in minutes for the current locale.

Example

var dt = new Date("December 25, 1995 23:15:00"); 
console.log("getTimezoneoffset() : " + dt.getTimezoneOffset()); 

Output

getTimezoneoffset() : -330  
Advertisements