|
|
|
@ -6,6 +6,7 @@ import (
|
|
|
|
|
|
|
|
|
|
// 格式化
|
|
|
|
|
const (
|
|
|
|
|
FormatDate = "2006-01-02"
|
|
|
|
|
FormatDatetime = "2006-01-02 15:04:05"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@ -47,6 +48,14 @@ func (t Timestamp) Time() time.Time {
|
|
|
|
|
return time.Unix(t.Int64(), 0)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Date 回傳日期字串
|
|
|
|
|
func (t Timestamp) Date() string {
|
|
|
|
|
return time.
|
|
|
|
|
Unix(t.Int64(), 0).
|
|
|
|
|
In(Local).
|
|
|
|
|
Format(FormatDate)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Datetime 回傳時間字串
|
|
|
|
|
func (t Timestamp) Datetime() string {
|
|
|
|
|
return time.
|
|
|
|
|