You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gotime/yesterday.go

18 lines
299 B

package gotime
import (
"time"
)
// Yesterday 昨天
func Yesterday() Pro {
p := NewPro()
location, err := time.LoadLocation("Asia/Shanghai")
if err != nil {
p.Time = time.Now().Add(time.Hour*8).AddDate(0, 0, -1)
} else {
p.Time = time.Now().In(location).AddDate(0, 0, -1)
}
return p
}