gf/os/gtime/gtime_time_wrapper.go

26 lines
624 B
Go
Raw Normal View History

2021-01-17 21:46:25 +08:00
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2020-02-16 18:07:05 +08:00
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package gtime
import (
"time"
)
// wrapper is a wrapper for stdlib struct time.Time.
2020-02-16 18:07:05 +08:00
// It's used for overwriting some functions of time.Time, for example: String.
type wrapper struct {
2020-02-16 18:07:05 +08:00
time.Time
}
// String overwrites the String function of time.Time.
func (t wrapper) String() string {
2020-02-16 18:07:05 +08:00
if t.IsZero() {
return ""
}
return t.Format("2006-01-02 15:04:05")
}