From 82a530d77903777a53a09928d21098d5e21a431b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Sat, 8 Apr 2023 14:48:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=B7=A5=E5=85=B7=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E4=BC=A0=E5=85=A5layout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- time.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/time.go b/time.go index 876da61..ac11065 100644 --- a/time.go +++ b/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 格式化纳秒时间戳