requirement:
format time in YYYYMMDDHHmmssSSS
format, UTC+8 timezone
t := time.Now()
ts := fmt.Sprintf("%d%02d%02d%02d%02d%02d%03d",t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(),t.UnixMilli()%1000)
Although there’s so many time format methods, I find this is a generic way.
最新评论