JavaScript getTimezoneOffset () method
Examples
Returns the difference between GMT and local time:
var d = new Date()
var n = d.getTimezoneOffset();
var n = d.getTimezoneOffset();
n output:
try it"
Definition and Usage
getTimezoneOffset () method returns the offset from Greenwich Mean Time and local time, in minutes.
For example, if the time zone is GMT + 2, returns -120.
Note: Due tothe use of the practice of daylight saving time, the return value is not a constant of the process.
Tip: Coordinated Universal Time, also known as the unified world time, Universal Time, Coordinated Universal Time, abbreviated UTC (Universal Coordinated Time).
Note: UTC time is the GMT (Greenwich Mean) time.
Browser Support
All major browsers support getTimezoneOffset () method
grammar
Date.getTimezoneOffset()
return value
类型 | 描述 |
---|---|
Number | 本地时间与 GMT 时间之间的时间差,以分钟为单位。 |
technical details
JavaScript version: | 1.0 |
---|