1、time按照格式转化

1
timeString := timeNow.Format("2006-01-02 15:04:05") //2015-06-15 08:52:32

2、时间戳转time

1
timeNow := time.Unix(timestamp, 0) //2017-08-30 16:19:19 +0800 CST

3、字符串转时间

1
d, _ := time.Parse("2006-01-02 15:04:05", dateStr)

更多用法可参考:https://cloud.tencent.com/developer/article/1456484?from=10910