Skip to content

time: time.String() defines format only in comment, with no matching Parse string #9596

@mattyw

Description

@mattyw

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions