Commit e6d101a2 by feidy

update time utils

parent 999d400f
......@@ -26,9 +26,9 @@ func Today() time.Time {
return time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
}
func Yesterday() time.Time{
func Yesterday() time.Time {
t := time.Now()
return time.Date(t.Year(), t.Month(),t.Day()-1, 0, 0, 0, 0, t.Location())
return time.Date(t.Year(), t.Month(), t.Day()-1, 0, 0, 0, 0, t.Location())
}
// ToDay 2019-08-21 22:07:07 -> 2019-08-21 00:00:00
......@@ -109,10 +109,10 @@ func FormatRFC3339(t time.Time) string {
return t.Format(RFC3339)
}
func YesterdayStart()int64{
func YesterdayStart() int64 {
return TimeToTimestamp(Yesterday())
}
func YesterdayEnd()int64{
func YesterdayEnd() int64 {
return TimeToTimestamp(Today()) - 1000
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment