Home  >  Article  >  Web Front-end  >  Use js to determine whether the current time zone TimeZone is daylight saving time_javascript skills

Use js to determine whether the current time zone TimeZone is daylight saving time_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:58:271744browse
Copy code The code is as follows:

var d1 = new Date(2009, 0, 1);
var d2 = new Date(2009, 6, 1);
if (d1.getTimezoneOffset() != d2.getTimezoneOffset())
{
alert('Daylight Saving Time'); // Daylight Saving Time
}
else
{
alert('Daylight Time'); //Non-Daylight Saving Time
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn