starttime
This commit is contained in:
parent
fe4cda2ff8
commit
6a82cda1af
10
time.go
10
time.go
|
|
@ -50,8 +50,9 @@ func GetNowTime() string {
|
||||||
|
|
||||||
// 获取一天开始的时间戳
|
// 获取一天开始的时间戳
|
||||||
func GetTodayStartTime() int64 {
|
func GetTodayStartTime() int64 {
|
||||||
now := time.Now().Unix()
|
now := time.Now()
|
||||||
return now - (now+28800)%86400
|
t := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
|
||||||
|
return t.Unix()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取一周开始的时间戳
|
// 获取一周开始的时间戳
|
||||||
|
|
@ -67,8 +68,9 @@ func GetWeekStartTime() int64 {
|
||||||
|
|
||||||
// 获取一月开始的时间戳
|
// 获取一月开始的时间戳
|
||||||
func GetMonthStartTime() int64 {
|
func GetMonthStartTime() int64 {
|
||||||
now := time.Now().AddDate(0, 0, 1-time.Now().Day()).Unix()
|
now := time.Now()
|
||||||
return now - (now+28800)%86400
|
t := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, now.Location())
|
||||||
|
return t.Unix()
|
||||||
}
|
}
|
||||||
|
|
||||||
func TimeToWeek(t int64) string {
|
func TimeToWeek(t int64) string {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue