Package gview: build-in function 'date' supports printing current datetime.

This commit is contained in:
John 2018-12-05 15:52:38 +08:00
parent 83f5a9d34e
commit 7022486e93

View File

@ -294,7 +294,8 @@ func (view *View) funcDate(format string, timestamp...interface{}) string {
t := int64(0) t := int64(0)
if len(timestamp) > 0 { if len(timestamp) > 0 {
t = gconv.Int64(timestamp[0]) t = gconv.Int64(timestamp[0])
} else { }
if t == 0 {
t = gtime.Millisecond() t = gtime.Millisecond()
} }
return gtime.NewFromTimeStamp(t).Format(format) return gtime.NewFromTimeStamp(t).Format(format)