You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AddDate normalizes its result in the same way that Date does, so, for example, adding one month to October 31 yields December 1, the normalized form for November 31.
Go version
go version go1.20.5 darwin/amd64
go env
:What did i do?
package main
import (
"fmt"
"time"
)
func main() {
d := time.Date(2023, 1, 30, 23, 0, 0, 0, time.Local)
dd := d.AddDate(0, 1, 0)
fmt.Println(dd)
}
What did i see happen?
2023-03-02 23:00:00 +0000 UTC
What did i expect to see?
In my intuitive understanding, I believe the output should be 2023-02-28 (9) 23:00:00 +0000 UTC
The text was updated successfully, but these errors were encountered: