This commit is contained in:
aozhiwei 2023-09-09 10:51:49 +08:00
parent f913e480a2
commit d72fab5c83

View File

@ -116,18 +116,18 @@ func IsNumberType(v interface{}) bool {
} }
} }
func FormatUnixDateTime(sec int64) string { func FormatUnixDateTime(sec int64, loc *time.Location) string {
strTime := time.Unix(sec, 0).Format("2006-01-02 15:04:05") strTime := time.Unix(sec, 0).In(loc). Format("2006-01-02 15:04:05")
return strTime return strTime
} }
func FormatUnixDate(sec int64) string { func FormatUnixDate(sec int64, loc *time.Location) string {
strTime := time.Unix(sec, 0).Format("2006-01-02") strTime := time.Unix(sec, 0).In(loc).Format("2006-01-02")
return strTime return strTime
} }
func FormatUnixDateEx(sec int64) string { func FormatUnixDateEx(sec int64, loc *time.Location) string {
strTime := time.Unix(sec, 0).Format("20060102") strTime := time.Unix(sec, 0).In(loc).Format("20060102")
return strTime return strTime
} }