Skip to content
New issue

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

time.parse cann ot parse RFC3339 reference string (or any other I tried) #68527

Closed
kscholty opened this issue Jul 20, 2024 · 3 comments
Closed

Comments

@kscholty
Copy link

kscholty commented Jul 20, 2024

Go version

go version 1.22.0 linux/amd64

Output of go env in your module/workspace:

MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/user/.cache/go-build'
GOENV='/home/user/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/user/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/user/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/user/go/pkg/mod/golang.org/[email protected]
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/user/go/pkg/mod/golang.org/[email protected]
GOVCS=''
GOVERSION='go1.22.0'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/user/Dokumente/devel/evcc/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'

What did you do?

t, err := time.Parse(time.RFC3339, time.RFC3339)
if err != nil {
   fmt.Print(err)
} else {
  fmt.Printf("Formatted %s", t.Format(time.RFC3339))
}

What did you see happen?

parsing time "2006-01-02T15:04:05Z07:00": extra text: "07:00"

What did you expect to see?

No error, correctly parsed value in t

Expected output:
Formatted: 2006-01-02T15:04:05Z07:00

@kscholty
Copy link
Author

Maybe related to #205555

@seankhliao
Copy link
Member

Duplicate of #9346

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants