Time Zone Javascript

Asked

Viewed 334 times

6

I have an app, where I get Time Zone from PC.

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

In my situation, it returns 180, I believe it is -3 Hours (180 / 3). Thus, I have doubts about which is the largest Timezone and which is the smallest. On a site I saw specifying -12 and +14 (720 and -840). Someone can confirm me this data because I need to validate a Timezone field.

1 answer

3

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

Reference: Date.prototype.getTimezoneOffset()

Browser other questions tagged

You are not signed in. Login or sign up in order to post.