尝试ADDDATE:
package mainimport ( "fmt" "time")func main() { now := time.Now() fmt.Println("now:", now) then := now.AddDate(0, -1, 0) fmt.Println("then:", then)}
产生:
now: 2009-11-10 23:00:00 +0000 UTCthen: 2009-10-10 23:00:00 +0000 UTC
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)