Time Zone JavaScript

6

I have an application, where I get Time Zone from the PC.

var d = new Date()
var n = d.getTimezoneOffset();

In my situation, it returns 180, I believe it is -3 Hours (180/3). So, I have doubts which is the larger TimeZone and which is smaller. On a website I've seen specifying -12 and +14 (720 and -840). Can anyone confirm this data to me, since I need to validate a TimeZone field.

    
asked by anonymous 30.07.2016 / 14:12

1 answer

3

The number returned by the getTimezoneOffset function is the difference in minutes from local time to UTC, that is, 180 is the equivalent of GMT-3 , > -120 is the equivalent of GMT + 2 and so on.

Reference: Date.prototype. getTimezoneOffset ()

    
02.11.2016 / 00:25