代码拉取完成,页面将自动刷新
package utils
import (
//"fmt"
"time"
)
/*
func GetDate(timestamp int64) string {
tm := time.Unix(timestamp, 0)
return tm.Format("2006-01-02 15:04")
}
func GetDateMH(timestamp int64) string {
tm := time.Unix(timestamp, 0)
return tm.Format("01-02 03:04")
}*/
func GetDateFormat(timestamp int64, format string) string {
if timestamp <= 0 {
return ""
}
tm := time.Unix(timestamp, 0)
return tm.Format(format)
}
func GetDate(timestamp int64) string {
if timestamp <= 0 {
return ""
}
tm := time.Unix(timestamp, 0)
return tm.Format("2006-01-02")
}
func GetDateMH(timestamp int64) string {
if timestamp <= 0 {
return ""
}
tm := time.Unix(timestamp, 0)
return tm.Format("2006-01-02 15:04")
}
func GetTimeParse(times string) int64 {
if "" == times {
return 0
}
loc, _ := time.LoadLocation("Local")
parse, _ := time.ParseInLocation("2006-01-02 15:04", times, loc)
return parse.Unix()
}
func GetDateParse(dates string) int64 {
if "" == dates {
return 0
}
loc, _ := time.LoadLocation("Local")
parse, _ := time.ParseInLocation("2006-01-02", dates, loc)
return parse.Unix()
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。