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: include const for time.Time.String()'s layout #6587

Closed
gopherbot opened this issue Oct 14, 2013 · 2 comments

Comments

Projects
None yet
2 participants
@gopherbot
Copy link

commented Oct 14, 2013

by michael.schurter:

The layout used by the time.Time.String() method is hardcoded into the method. If it
were a constant it would be easier to roundtrip time.Time's through a string (or []byte)
without having to copy and paste the layout out of Time.String's docstring.

Relevant code: https://code.google.com/p/go/source/browse/src/pkg/time/format.go#397
@robpike

This comment has been minimized.

Copy link
Contributor

commented Oct 15, 2013

Comment 1:

Status changed to Started.

@robpike

This comment has been minimized.

Copy link
Contributor

commented Oct 15, 2013

Comment 2:

The default format string is a clumsy one whose sole merit is that it represents all the
pieces of the value. Few uses need that property alone. A better approach is to choose a
format that meets your needs (say, RFC3999Nano) and use that explicitly. The only reason
to publish this as a constant is to parse a default value again. If you're parsing, it's
better to be clear about what you're printing too.

Status changed to WorkingAsIntended.

This issue was closed.

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.