Javascript's Date.getTimezoneOffset()

前端 未结 2 1711
天命终不由人
天命终不由人 2020-12-09 00:41

I\'m trying to compare a GMT time offset from the operating system to a GMT time offset from Javascript\'s Date.getTimezoneOffset(). The problem is windows gives an offset b

2条回答
  •  独厮守ぢ
    2020-12-09 01:07

    Why not call getTimezoneOffset on a date where you know daylight saving time is not in force?

    javascript:alert(new Date('1/1/2009').getTimezoneOffset())
    

    That will give 300 (5 hours).

提交回复
热议问题