Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
time: time.String() defines format only in comment, with no matching Parse string #9596
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?
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?