We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tip
go env
GO111MODULE='' GOARCH='amd64' GOBIN='' GOCACHE='/home/iant/.cache/go-build' GOENV='/home/iant/.config/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='amd64' GOHOSTOS='linux' GOINSECURE='' GOMODCACHE='/home/iant/gopath/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='linux' GOPATH='/home/iant/gopath' GOPRIVATE='' GOPROXY='https://proxy.golang.org' GOROOT='/home/iant/go' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/home/iant/go/pkg/tool/linux_amd64' GOVCS='' GOVERSION='devel go1.24-8659ad972f Wed Jul 24 00:40:06 2024 +0000' GODEBUG='' GOTELEMETRY='on' GOTELEMETRYDIR='/home/iant/.config/go/telemetry' GCCGO='gccgo' GOAMD64='v1' AR='ar' CC='gcc' CXX='g++' CGO_ENABLED='1' GOMOD='/dev/null' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3145192880=/tmp/go-build -gno-record-gcc-switches'
package main import ( "fmt" "time" ) const secondsPerDay = 24 * 60 * 60 func main() { date := time.Date(1899, time.December, 31, 0, 0, 0, 0, time.UTC) uday := int(date.Unix() / secondsPerDay) t := time.Unix(0, 0).AddDate(0, 0, uday) fmt.Println(t) }
This is the output from Go tip following https://go.dev/cl/586257.
11761121-01-20 00:00:00 +0000 UTC
This is the output from Go 1.23:
1899-12-31 00:00:00 +0000 UTC
The text was updated successfully, but these errors were encountered:
Related Issues and Documentation
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Sorry, something went wrong.
Testing a patch.
Change https://go.dev/cl/602815 mentions this issue: time: restore support for large negative days in Date
time: restore support for large negative days in Date
2ffcfce
No branches or pull requests
Go version
tip
Output of
go env
in your module/workspace:What did you do?
What did you see happen?
This is the output from Go tip following https://go.dev/cl/586257.
What did you expect to see?
This is the output from Go 1.23:
The text was updated successfully, but these errors were encountered: