一波更新
This commit is contained in:
29
trunk/center/common/mytime/timefuncs.go
Normal file
29
trunk/center/common/mytime/timefuncs.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package mytime
|
||||
|
||||
import (
|
||||
"goutil/logUtilPlus"
|
||||
"time"
|
||||
)
|
||||
|
||||
/*func GetZeroTime(t int64, timezone int) int64 {
|
||||
return t - (t+int64(timezone))%86400
|
||||
}
|
||||
|
||||
func IsDiffDay(second, first int64, timezone int) int {
|
||||
secondZeroTime := GetZeroTime(second, timezone)
|
||||
firstZeroTime := GetZeroTime(first, timezone)
|
||||
return int(secondZeroTime/86400 - firstZeroTime/86400)
|
||||
}*/
|
||||
|
||||
func DiffDays(new, old int64) int64 {
|
||||
newZeroTime := ZeroTime(new, 0)
|
||||
oldZeroTime := ZeroTime(old, 0)
|
||||
logUtilPlus.ErrorLog("newZeroTime=%d,oldZeroTime=%d", newZeroTime, oldZeroTime)
|
||||
return newZeroTime/86400 - oldZeroTime/86400
|
||||
}
|
||||
|
||||
func ZeroTime(sec, nsec int64) int64 {
|
||||
dateStr := time.Unix(sec, nsec).Format("2006-01-02")
|
||||
t, _ := time.ParseInLocation("2006-01-02", dateStr, time.Local)
|
||||
return t.Unix()
|
||||
}
|
||||
Reference in New Issue
Block a user