package util import ( "time" ) // NowMilli 获得当前时间,毫秒级 func NowMilli() int64 { return time.Now().Local().UnixNano() / int64(time.Millisecond) } // 当天时间的0点 func DayZeroStart(add time.Duration) int64 { now := time.Now() startTime := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) startTime = startTime.Add(add) return startTime.UnixNano() / 1e6 } // 当天时间的0点 func DayZeroStartTime(add time.Duration) time.Time { now := time.Now() startTime := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) startTime = startTime.Add(add) return startTime } func Now13() int64 { return time.Now().UnixNano() / 1e6 } func Now10() int64 { return time.Now().Unix() }