@
silov 自己写个辅助函数转一下即可
```go
// Format time.Time struct to string
// MM - month - 01
// M - month - 1, single bit
// DD - day - 02
// D - day 2
// YYYY - year - 2006
// YY - year - 06
// HH - 24 hours - 03
// H - 24 hours - 3
// hh - 12 hours - 03
// h - 12 hours - 3
// mm - minute - 04
// m - minute - 4
// ss - second - 05
// s - second = 5
func FormatDate(format string, t ...time.Time) string {
var datetime time.Time
if len(t) == 0 {
datetime = time.Now()
} else {
datetime = t[0]
}
res := strings.Replace(format, "MM", datetime.Format("01"), -1)
res = strings.Replace(res, "M", datetime.Format("1"), -1)
res = strings.Replace(res, "DD", datetime.Format("02"), -1)
res = strings.Replace(res, "D", datetime.Format("2"), -1)
res = strings.Replace(res, "YYYY", datetime.Format("2006"), -1)
res = strings.Replace(res, "YY", datetime.Format("06"), -1)
res = strings.Replace(res, "HH", fmt.Sprintf("%02d", datetime.Hour()), -1)
res = strings.Replace(res, "H", fmt.Sprintf("%d", datetime.Hour()), -1)
res = strings.Replace(res, "hh", datetime.Format("03"), -1)
res = strings.Replace(res, "h", datetime.Format("3"), -1)
res = strings.Replace(res, "mm", datetime.Format("04"), -1)
res = strings.Replace(res, "m", datetime.Format("4"), -1)
res = strings.Replace(res, "ss", datetime.Format("05"), -1)
res = strings.Replace(res, "s", datetime.Format("5"), -1)
return res
}```