Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
49
rated 0 times [  55] [ 6]  / answers: 1 / hits: 20811  / 14 Years ago, mon, may 24, 2010, 12:00:00

I need to determine the client timezone (e.g. CET, GMT, EST) in JS. Getting the offset is straightforward, but doesn't have all the info necessary to determine the TZ, at least not easily. I have a feeling it might be possible to use a combination of offset, whether DST is in use and in effect, etc. but I'm hoping someone else has done the work already, especially considering the weird exceptions when dealing with time.



This question is similar but both the question and the answer are based on the (incorrect) assumption every browser's DateString format includes the name of the timezone - which it does not. That is an implementation detail.



So, with that I am currently stuck.


More From » datetime

 Answers
24

See this question. It's not doable in the general case, but for picking a default timezone from a shortlist of likely cases, you can make a decent guess.



Allow the user to override it for when you guess wrong.


[#96699] Thursday, May 20, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tomas

Total Points: 165
Total Questions: 111
Total Answers: 103

Location: Maldives
Member since Tue, Dec 21, 2021
3 Years ago
tomas questions
Thu, Jan 27, 22, 00:00, 2 Years ago
Mon, May 10, 21, 00:00, 3 Years ago
Tue, Jan 5, 21, 00:00, 3 Years ago
;