I am using the below mentioned code for getting the timezone name/id in the clients timezone. Using the below code I get EDT
for United state clients but now when I try it in Indian timezone I get it as UTC
instead of IST
.
This issue is occurring only for IE all other browsers give me the correct values, how can I get the correct value in IE which is IST
?
var now = new Date().toString();
var TZ = now.indexOf('(') > -1 ?
now.match(/\([^\)]+\)/)[0].match(/[A-Z]/g).join('') :
now.match(/[A-Z]{3,4}/)[0];
if (TZ == "GMT" && /(GMT\W*\d{4})/.test(now))
TZ = RegExp.$1;
document.write(TZ);