-
Notifications
You must be signed in to change notification settings - Fork 18k
time: Time.String() can return "+0000 +0000" as time zone #11712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The playground acts differently because the local time zone for the playground is UTC. I think the package is acting as documented. The question is whether we should change time.Parse to treat a timezone of +0000 as meaning UTC. |
Yeah, I'm not sure why the default format includes the time zone twice ( |
This is working as intended. The default output is making sure to print the name and the zone offset of the location. In this case they're the same. It would be weird if some locations printed fewer fields. |
I don't think I was asking for fewer fields, merely if the default/empty location |
@rsc @calmh @ianlancetaylor did anything ever come of this? I ask because I'm running into a similar issue (posted on Stack Overflow about it if it's helpful to see), though I think I now understand why. I was seeing inconsistencies with how an RFC 3339 time was interpreted on my local machine vs. on a CI server (and on the Go Playground). Please bear with my examples to see if I understand correctly! (1)
Since the CI server in question has its time set to UTC (as does the Go Playground), then UTC is set to be the location. Since my local machine does not have its timezone set to UTC, a "fabricated" location is set. (2) Those two examples are shown here: https://play.golang.org/p/mYkMhS9sJT (with the output I see on my local machine included). If all of that is correct, I guess my last question is: is
Thanks for the help! |
Please do not hold discussions on closed issues, nobody will see them. |
Whoops, sorry about that, thanks for pointing me to the right place! Will ask there instead. |
I guess this is due to
in Parse...? However, perhaps the fabricated location for +0000 should be UTC? It also seems system specific, as http://play.golang.org/p/NYpETX_L9a actually prints UTC in both cases.
(Dates returned from database/sql, at least with the github.com/lib/pq driver, suffer from this so it's not only synthetic.)
The text was updated successfully, but these errors were encountered: