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: time.String() defines format only in comment, with no matching Parse string #9596
Comments
+1 |
https://github.com/golang/go/blob/master/src/time/format.go#L400 We cant change it currently but we could use a const here and add it to the format consts that are exported. That would not change the output and give others access to the format string. If later a incompatible change is possible we can define that new const as RFC3339. What would be a good name for it? StdDate? |
I suggested TimeString as a possibility. I did consider Std, but it's not really "standard". |
Since it is already in the time package. time.FormatString sounds better to me. |
What about "time.Go" since we have already "time.Ruby" and this would resonate. |
We have "time.RubyDate" so then it would rather be "time.GoDate" however this sounds to me more like its special and not so much the default for String(). |
This is a duplicate of issue #6587 |
So it is, and that issue was closed as working as intended. So, closing. |
The documentation for time.String() shows the format used to convert time into a string: http://golang.org/pkg/time/#Time.String.
This string appears to be different to the const formats already defined in the time package, so if I wanted to naively (not using time.Format) convert a time -> string -> time I'd need to copy the format from the docs into my code and use it in a call to time.Parse.
In addition this format string is used a few times in http://golang.org/src/time/format_test.go as a literal string.
Isn't this format string a good candidate to be placed in the consts?
The text was updated successfully, but these errors were encountered: