21 lines
401 B
Go
21 lines
401 B
Go
package utils
|
|
|
|
import "time"
|
|
|
|
// 判断时间点处于今天
|
|
func IsToday(d int64) bool {
|
|
tt := time.Unix(d, 0)
|
|
now := time.Now()
|
|
return tt.Year() == now.Year() && tt.Month() == now.Month() && tt.Day() == now.Day()
|
|
}
|
|
|
|
//判断是否大于1周
|
|
func IsAfterWeek(d int64) bool {
|
|
tt := time.Unix(d, 0)
|
|
now := time.Now()
|
|
if !tt.Before(now) {
|
|
return false
|
|
}
|
|
return now.Sub(tt) >= time.Hour*24*7
|
|
}
|