Quantcast
Channel: Getting the client's time zone (and offset) in JavaScript - Stack Overflow
Viewing all articles
Browse latest Browse all 34

Answer by pluto for Getting the client's time zone (and offset) in JavaScript

$
0
0

Once I had this "simple" task and I used (new Date()).getTimezoneOffset() - the approach that is widely suggested here. But it turned out that the solution wasn't quite right.For some undocumented reasons in my case new Date() was returning GMT+0200 when new Date(0) was returning GMT+0300 which was right. Since then I always use

(new Date(0)).getTimezoneOffset() to get a correct timeshift.


Viewing all articles
Browse latest Browse all 34

Trending Articles





<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>