Skip to content
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

time: Minor documentation correction for pkg/time/#Time.Format #11190

Closed
harikb opened this issue Jun 12, 2015 · 3 comments

Comments

Projects
None yet
6 participants
@harikb
Copy link

commented Jun 12, 2015

The documentation should mention that the example for http://golang.org/pkg/time/#Time.Format prints the same value for t.Format() and t.UTC().Format(). Reader may assume Format() always prints UTC. I think it behaves that way only because play.golang.org server runs in UTC. May be you should do one of

  1. set play.golang.org to a different timezone because UTC is so special (for the rest of the world)
  2. or document this near / inside the example.
  3. or change the example to use a different timezone instead of time.Local

@ianlancetaylor ianlancetaylor changed the title Minor documentation correction for pkg/time/#Time.Format time: Minor documentation correction for pkg/time/#Time.Format Jun 12, 2015

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2015

Interesting point. The example is clear enough, and if you run it yourself the expected thing will happen, but if you run it by clicking on the button on golang.org it will indeed always print in UTC.

I guess my vote is to expand the comment in the example to mention what happens on golang.org.

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Jun 12, 2015

@adg

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2015

At tip the example has been made much more complete, and I don't think it suffers from the same muddiness as the original pithy one:

http://tip.golang.org/pkg/time/#Time.Format

@robpike

This comment has been minimized.

Copy link
Contributor

commented Jun 15, 2015

Fixed at tip.

@robpike robpike closed this Jun 15, 2015

@mikioh mikioh modified the milestones: Go1.5, Go1.6 Jun 17, 2015

@golang golang locked and limited conversation to collaborators Jun 25, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.