package util import "time" // GetNowYmdHms 获取当前datetime func GetNowYmdHms() string { return time.Now().Format("2006-01-02 15:04:05") } // GetNowUnix 获取当前时间戳 func GetNowUnix() int64 { return time.Now().Unix() } func ParseInLocation(str string) time.Time { //str := "2020-10-12 14:19:53" tmp := "2006-01-02 15:04:05" t, _ := time.ParseInLocation(tmp, str, time.Local) return t }