时间工具支持传入layout
This commit is contained in:
parent
f5fddb92e8
commit
82a530d779
7
time.go
7
time.go
@ -26,8 +26,11 @@ type ownTime struct {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 1:34 上午 2021/10/7
|
||||
func (ot *ownTime) GetCurrentFormatTime() string {
|
||||
return time.Now().In(time.Local).Format("2006-01-02 15:04:05")
|
||||
func (ot *ownTime) GetCurrentFormatTime(layout ...string) string {
|
||||
if len(layout) == 0 {
|
||||
layout = []string{"2006-01-02 15:04:05"}
|
||||
}
|
||||
return time.Now().In(time.Local).Format(layout[0])
|
||||
}
|
||||
|
||||
// FormatUnixNano 格式化纳秒时间戳
|
||||
|
Loading…
Reference in New Issue
Block a user