1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-08 06:32:28 +08:00

feat: add GetTodayStartTime and GetTodayEndTime

This commit is contained in:
dudaodong
2023-06-29 11:03:28 +08:00
parent 7d56da8108
commit bf50baa07d
4 changed files with 145 additions and 31 deletions

View File

@@ -96,6 +96,18 @@ func GetNowDateTime() string {
return time.Now().Format("2006-01-02 15:04:05")
}
// GetTodayStartTime return the start time of today, format: yyyy-mm-dd 00:00:00.
// Play: todo
func GetTodayStartTime() string {
return time.Now().Format("2006-01-02") + " 00:00:00"
}
// GetTodayEndTime return the end time of today, format: yyyy-mm-dd 23:59:59.
// Play: todo
func GetTodayEndTime() string {
return time.Now().Format("2006-01-02") + " 23:59:59"
}
// GetZeroHourTimestamp return timestamp of zero hour (timestamp of 00:00).
// Play: https://go.dev/play/p/QmL2oIaGE3q
func GetZeroHourTimestamp() int64 {