-2

I am a bit confused with this, i know the code gives me the time difference from GMT, but for which city or country? How do i get the time difference between gmt and the time in Kabul Afghanistan.

            var now = new Date();
            alert(now.getTimezoneOffset());

2 Answers2

0

The difference is the value showing in the alert.

웃웃웃웃웃
  • 11,829
  • 15
  • 59
  • 91
0

It gives you the offset of the client local time zone.

To get the offset of different time zone, use external libraries as stated here, or just get the offset manually and use it, as explained here.

Community
  • 1
  • 1
BobTheBuilder
  • 18,858
  • 6
  • 40
  • 61