-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Description
Go version
go version go1.22.4 darwin/amd64
Output of go env
in your module/workspace:
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/Users/deke/Library/Caches/go-build'
GOENV='/Users/deke/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/deke/.gvm/pkgsets/go1.22.4/global/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/deke/.gvm/pkgsets/go1.22.4/global'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/deke/.gvm/gos/go1.22.4'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/deke/.gvm/gos/go1.22.4/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.22.4'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'
CXX='clang++'
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 -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/kx/hbhfkyvn3d903_g_1hwrx3h80000gn/T/go-build236193593=/tmp/go-build -gno-record-gcc-switches -fno-common'
What did you do?
Parsing a time string with a "Z" time zone using a time format that includes time zone seconds fails.
https://go.dev/play/p/FgeEzRinnL8
What did you see happen?
The call to time.Parse
returned an error. For example, this code:
tm, err = time.Parse("2006-01-02T15:04:05Z070000", "2024-07-01T12:34:56Z")
fmt.Println(tm)
fmt.Println(err)
outputs:
0001-01-01 00:00:00 +0000 UTC
parsing time "2024-07-01T12:34:56Z" as "2006-01-02T15:04:05Z070000": cannot parse "Z" as "Z070000"
What did you expect to see?
The call to time.Parse
to succeed and return a time with the UTC time zone location. For example, this code:
tm, err = time.Parse("2006-01-02T15:04:05Z070000", "2024-07-01T12:34:56Z")
fmt.Println(tm)
fmt.Println(err)
SHOULD output:
2024-07-01 12:34:56 +0000 UTC
<nil>
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.