gf/os/gtime/gtime_time_wrapper.go

26 lines
631 B
Go

// Copyright 2019 gf Author(https://github.com/gogf/gf). All Rights Reserved.
//
// 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.
// It's used for overwriting some functions of time.Time, for example: String.
type wrapper struct {
time.Time
}
// String overwrites the String function of time.Time.
func (t wrapper) String() string {
if t.IsZero() {
return ""
}
return t.Format("2006-01-02 15:04:05")
}