From 28f990d7bd9fa0e7680f0c35de7174c2b7bd1065 Mon Sep 17 00:00:00 2001 From: gazebo Date: Tue, 6 Nov 2018 14:37:21 +0800 Subject: [PATCH] - GetCurDate --- utils/utils.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utils/utils.go b/utils/utils.go index 75deb10e..7c2bddc7 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -88,6 +88,12 @@ func GetCurTimeStr() string { return Time2Str(time.Now()) } +func GetCurDate() time.Time { + now := time.Now() + year, month, day := now.Date() + return time.Date(year, month, day, 0, 0, 0, 0, now.Location()) +} + // timestamp is in second func GetCurTimestamp() int64 { return time.Now().Unix()