Hướng dẫn get utc timezone javascript
The Nội dung chính Nội dung chính
Try itSyntaxReturn valueThe difference, in minutes, between the date as evaluated in the UTC time zone and as evaluated in the local time zone. The actual local time algorithm is implementation-defined, and the return value is allowed to be zero in runtimes without appropriate data. Description
Negative values and positive valuesThe number of minutes returned by Varied results in Daylight Saving Time (DST) regionsIn a region that annually shifts in and out of Daylight Saving Time (DST),
as Note: In most implementations, the IANA time zone database (tzdata) is used to precisely determine the offset of the local timezone at the moment of the ExamplesUsing getTimezoneOffset()
getTimezoneOffset() and DSTIn regions that use DST, the return value may change based on the time of the year
getTimezoneOffset() and historical dataDue to historical reasons, the timezone a region is in can be constantly changing, even disregarding DST. For example, below is the output in a runtime in Shanghai, where the timezone is UTC+08:00.
This is because during the Sino-Japanese War when Shanghai was under Japanese control, the timezone was changed to UTC+09:00 to align with Japan's (in effect, it was a "year-round DST"), and this was recorded in the IANA database. Specifications
Browser compatibilityBCD tables only load in the browser See also |