This is a creation in Article, where the information may have evolved or changed.
In the past, using java,python,php, and other languages, to format a time into a string is the "Yyy-mm-dd hh:mm:ss" method, Golang format method really eye-opener
First look at the Official document description:
Func (Time) Format
Func (t time) Format (layout string) string
Format returns a textual representation of the time value formatted according to layout, which defines the format by Showi ng How the reference time, defined
Mon Jan 2 15:04:05-0700 MST 2006
Would be displayed if it were the value; It serves as an example of the desired output. The same display rules would then is applied to the time value. Predefined layouts Ansic, Unixdate, RFC3339 and others describe standard and convenient representations of the reference T Ime. For more information on the formats and the definition of the reference time, see the documentation for Ansic and the O Ther constants defined by the this package.
Here's a code:
Fmt. Println (time. Now (). Format ("2006-01-02 150405"))
Pay attention to that time, can only be 2006-01-02 15:04:05 minutes, other time is not good enough.