logo

time.Now().Format(utils.TimeLayout)
time.LoadLocation("Local")
//当前时间戳转换为日期格式
time.Now().Format(utils.TimeLayout)
//时间戳字段转换为日期格式
CreateTime 是变量
time.Unix(CreateTime, 0).Format(utils.TimeLayout)

将时间戳转换成年月日 时分秒格式
参考timelayout

const (
 TimeLayout         = "2006-01-02 15:04:05"
 TimeLayout2        = "20060102150405"
 TimeLayout3        = "2006-01-02"
 TimeLayout4        = "2006-01-02 00:00:00"
 TimeLayout5        = "2006-01-02 15:04"
 TimeLayout6        = "2006-01"
 TimeLayoutYear     = "2006"
 TimeLayoutMonth    = "01"
 TimeLayoutDay      = "02"
 TimeLayoutIntMonth = "1"
 TimeLayout7        = "2006/01/02 15:04:05"
 TimeLayout8        = "01-02"
 TimeLayout9        = "2006年01月"
)
  • 相关精彩文章
  • 点击最多内容