golang timestamp conversion give different result for timezone synonyms

Viewed 375

I know what Moscow Time set to UTC+03:00 So, timezone Europe/Moscow and Etc/GMT+3 have to be the same

But its not

msk, _ := time.LoadLocation("Europe/Moscow")
gmt3, _ := time.LoadLocation("Etc/GMT+3")
fmt.Println("MSK", now.In(msk).Format(isoFmt))
fmt.Println("GMT+3", now.In(gmt3).Format(isoFmt))

Check yourself. What am I doing wrong?

play gives a very strange result for isoFmt=time.RFC3339

MSK 2009-11-11T02:00:00+03:00
GMT+3 2009-11-10T20:00:00-03:00
1 Answers

These two time zones are not actually synonyms. According to the list of timezones, Europe/Moscow has UTC offset of +03:00, while Etc/GMT+3 has UTC offset of āˆ’03:00. Etc/GMT+3 is actually located somewhere in South America and some other locations.

So there is nothing wrong with Go (in this specific case), but the source of your confusion is very clear.

Related