You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I put the example code from the time.Parse docs on playground and I see a different output than the output in the doc. https://play.golang.org/p/tuBDbz66I0
When parsing a time with a zone abbreviation like MST, if the zone abbreviation has a defined offset in the current location, then that offset is used.
and
If the zone abbreviation is unknown, Parse records the time as being in a fabricated location with the given zone abbreviation and a zero offset
and
To avoid such problems, prefer time layouts that use a numeric zone offset, or use ParseInLocation
So you can either use the numeric offset, or call ParseInLocation:
That explanation makes sense. I did not realise the timezone database is on my computer, hence I found the disparity between my setup and play.golang.org weird.
What version of Go are you using (
go version
)?Playground one,
go version go1.8 darwin/amd64
,go version go1.7.3 darwin/amd64
, it's all wrong on these.What operating system and processor architecture are you using (
go env
)?The
go env
correspoding to thego version go1.7.3 darwin/amd64
version:What did you do?
I put the example code from
the time.Parse
docs on playground and I see a different output than the output in the doc. https://play.golang.org/p/tuBDbz66I0What did you expect to see?
2013-02-03 19:54:00 -0800 PST
(Same as in documentation here: https://golang.org/pkg/time/#Parse)
What did you see instead?
2013-02-03 19:54:00 +0000 PST
The text was updated successfully, but these errors were encountered: