Incorrect Timezone Name In Javascript Only In Ie
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 India
Solution 1:
Quoting MDN:
The
toTimeString()
method is especially useful because compliant engines implementing ECMA-262 may differ in the string obtained fromtoString()
forDate
objects, as the format is implementation-dependent; simple string slicing approaches may not produce consistent results across multiple engines.
I suggest you try using .toTimeString()
:
(newDate()).toTimeString().match(/\(([^\)]+)\)/)[1]
I believe that should give you what you want.
Post a Comment for "Incorrect Timezone Name In Javascript Only In Ie"