~~~ import ( "time" ) ~~~ //获取到当前时间戳 ~~~ time.Now().Unix() ~~~ 获取到当前日期 ~~~ template := "20060102" return time.Now().Format(template) ~~~ 获取到当前具体时间 ~~~ template := "2006-01-02 15:04:05" return time.Now().Format(template) ~~~