Golang获取当天时间范围
2022-05-19 00:00:00 +0800 CST 2022-05-19 23:59:59 +0800 CST
// GetCurrentTimestamp 获取当天的时间范围
//Time类型 2022-05-19 00:00:00 +0800 CST 2022-05-19 23:59:59 +0800 CST
func GetCurrentTimestamp() (beginTime, endTime time.Time) {
t := time.Now()
timeStr := t.Format("2006-01-02")
beginTime, _ = time.ParseInLocation("2006-01-02", timeStr, time.Local)
endTimeTmp := beginTime.Unix() + 86399
endTime = time.Unix(endTimeTmp, 0)
return beginTime, endTime
}