i would like to know if there is any possibility of getting timezone in format: gmt+05:30 delhi chennai mumbai kolkata.i need to do this in javascript and the timezone should be based on browser location.
Asked
Active
Viewed 49 times
0
-
4Possible duplicate of http://stackoverflow.com/questions/1091372/getting-the-clients-timezone-in-javascript – Aditya Gupta Jul 15 '16 at 04:44
2 Answers
1
You can use the getTimezoneOffset()
method to return the time difference between UTC time and your local time, in minutes.
Below an example on how to return the timezone difference between UTC and Local Time:
var d = new Date()
var n = d.getTimezoneOffset();
console.log(n);

GibboK
- 71,848
- 143
- 435
- 658
0
The answer to this question is a bit long and requires other libraries to function properly. Have a look at this website: https://css-tricks.com/localizing-times-in-javascript/
Hope it helps! :)

kmugi
- 343
- 1
- 4
- 13