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.
18 lines
299 B
18 lines
299 B
2 years ago
|
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
|
||
|
}
|