From 3d89177fec6fa5066b07a4528acbf7c69ddb48c8 Mon Sep 17 00:00:00 2001 From: kercylan98 Date: Wed, 24 May 2023 16:05:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E4=B8=80=E4=B8=AA=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=88=B0=E4=B8=8B=E4=B8=80=E5=A4=A9=E9=97=B4=E9=9A=94?= =?UTF-8?q?=E5=A4=9A=E5=B0=91=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/times/helper.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/times/helper.go b/utils/times/helper.go index a580b00..1b521b2 100644 --- a/utils/times/helper.go +++ b/utils/times/helper.go @@ -32,6 +32,11 @@ func WeekDay(t time.Time) int { return week } +// GetNextDayInterval 获取一个时间到下一天间隔多少秒 +func GetNextDayInterval(t time.Time) time.Duration { + return time.Duration(GetToday(t.AddDate(0, 0, 1)).Unix()-t.Unix()) * time.Second +} + // GetToday 获取一个时间的今天 func GetToday(t time.Time) time.Time { return time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, time.Local)