timestamp

This commit is contained in:
jiangyong 2026-03-06 14:42:46 +08:00
parent c1f338f977
commit 4c054b3215
1 changed files with 4 additions and 0 deletions

View File

@ -6,6 +6,10 @@ import (
)
func FormatTime(ts int64) string {
if ts <= 0 {
return ""
}
if ts < 1e10 { // 秒级10位
return time.Unix(ts, 0).Format("2006-01-02 15:04:05")
} else if ts < 1e13 { // 毫秒级13位