Skip to content

time.RFC3339 does not even parse with time.Parse #21443

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

Closed
wpsmithtwc opened this issue Aug 14, 2017 · 1 comment
Closed

time.RFC3339 does not even parse with time.Parse #21443

wpsmithtwc opened this issue Aug 14, 2017 · 1 comment

Comments

@wpsmithtwc
Copy link

wpsmithtwc commented Aug 14, 2017

Version: Latest: go version go1.8.3 darwin/amd64
Also reproducible on Go Playground.

What did you do?

https://play.golang.org/p/QvAVXmVMoR


import (
	"fmt"
	"time"
)

func main() {
	if time.RFC3339 == "2006-01-02T15:04:05Z07:00" {
		fmt.Println("These time.RFC3339 == '2006-01-02T15:04:05Z07:00'")
	}
	t, err := time.Parse(time.RFC3339, "2006-01-02T15:04:05Z07:00")
	if err != nil {
		panic(err)
	}
	fmt.Printf("t: %#v\n", t)
}

Result?

The date should parse correctly, but there is an error:

These time.RFC3339 == '2006-01-02T15:04:05Z07:00'
panic: parsing time "2006-01-02T15:04:05Z07:00": extra text: 07:00

goroutine 1 [running]:
main.main()
	/tmp/sandbox164093353/main.go:14 +0x1e0
@ianlancetaylor
Copy link
Contributor

Closing as dup of #9346. Please comment if you disagree.

@golang golang locked and limited conversation to collaborators Aug 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants