timestamp
This commit is contained in:
parent
c1f338f977
commit
4c054b3215
4
time.go
4
time.go
|
|
@ -6,6 +6,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func FormatTime(ts int64) string {
|
func FormatTime(ts int64) string {
|
||||||
|
if ts <= 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
if ts < 1e10 { // 秒级(10位)
|
if ts < 1e10 { // 秒级(10位)
|
||||||
return time.Unix(ts, 0).Format("2006-01-02 15:04:05")
|
return time.Unix(ts, 0).Format("2006-01-02 15:04:05")
|
||||||
} else if ts < 1e13 { // 毫秒级(13位)
|
} else if ts < 1e13 { // 毫秒级(13位)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue