This is a creation in Article, where the information may have evolved or changed.
Golang Time Processing
Package Mainimport ("FMT" "Time") const (Date = "2006-01-02" shortdate = "06-01-02" Times = "15:04:02" Shorttime = "15:04" datetime = "2006-01-02 15:04:02" newdatetime = "2006/01/02 15~04~02" newtime = "15~04~02 ") func main () {thisdate: =" 2014-03-17 14:55:06 "Timeformatdate, _: = time. Parse (datetime, Thisdate) fmt. Println (timeformatdate) Convdate: = Timeformatdate. Format (date) Convshortdate: = Timeformatdate. Format (shortdate) Convtime: = Timeformatdate. Format (times) Convshorttime: = Timeformatdate. Format (shorttime) Convnewdatetime: = Timeformatdate. Format (newdatetime) Convnewtime: = Timeformatdate. Format (NewTime) fmt. Println (convdate) fmt. Println (convshortdate) fmt. Println (Convtime) fmt. Println (Convshorttime) fmt. Println (Convnewdatetime) fmt. Println (Convnewtime)}
Formatting the current time
Lasttime, _: = time. Now (). Format ("2006-01-02 15:04:05")