Skip to content
Advertisement

get timezone in “+0100” (for example) format

I got lost between the documentation and the numerous time-related questions found by google.

What I want is very simple: a string that represents the running timezone in the “[+/-] [number] [number] [number] [number]” format (for instance “+0100”).

My current code is:

JavaScript

which returns “GMT” in my location, which I assume is the short version (3 letters) of the timezones.

Advertisement

Answer

Here is the code I actually ended up using, I hope it helps someone.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement