常用类型及数据操作方法
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

21 lines
386 B

package helper
import (
"strconv"
"time"
)
func FormatDateTime(str string) string {
date, err := strconv.ParseInt(str, 10, 64)
if err != nil {
return ""
}
return time.Unix(date, 0).Format("2006-01-02 15:04:05")
}
func FormatDate(str string) string {
date, err := strconv.ParseInt(str, 10, 64)
if err != nil {
return ""
}
return time.Unix(date, 0).Format("2006-01-02")
}