0

I receive an iso string with time zone like this: 2021-07-08T11:22:33+0200.

How can I get the time zone identifier (like Europe/Stockholm) from that string?

Note that I don't need my local or browser's time zone, but that one from the received date "+0200".

neptune
  • 1,211
  • 2
  • 19
  • 32
  • 4
    You can't, there's not enough info. There may be more than 1 timezone with that offset (+02:00) and no way to know which one it is. You may get lucky and find only 1 for an offset but they are few and far between (if they exist at all). – phuzi Jul 12 '22 at 09:15
  • It's not possible to find it unless identifier is in the string. There are many places in same time zone. You can never know – Deniz Karadağ Jul 12 '22 at 09:21
  • See this https://stackoverflow.com/questions/10087819/convert-date-to-another-timezone-in-javascript – redevil Jul 12 '22 at 09:34
  • There are only a few unique time zones, such as Kathmandu, Chatham Island, Lord Howe Island, Eucla. Do you have any other geolocation data to use, such as IP address? – Yogi Jul 12 '22 at 09:36
  • No. I think @phuzi and others were right. It can't be done only with that date string. – neptune Jul 12 '22 at 09:38

0 Answers0