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
time.Parse can not parse the default format produced by time.String()
go version
go1.7.1 linux/amd64
go env
GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="$HOME/.local/share/go" GORACE="" GOROOT="/usr/lib/go" GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64" CC="gcc" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build766838131=/tmp/go-build -gno-record-gcc-switches" CXX="g++" CGO_ENABLED="1"
https://play.golang.org/p/wmfQP5wX0S
func main() { t := time.Now().UTC() s := t.String() t, err := time.Parse(s,s) if err != nil { fmt.Println(s, "parsed with error", err) } else { fmt.Println(s, "equals", t.String()) } }
2016-09-27 16:53:03.13465009 +0000 UTC equals 2016-09-27 16:53:03.13465009 +0000 UTC
There were different out comes, local:
2016-09-27 16:53:03.13465009 +0000 UTC parsed with error parsing time "2016-09-27 16:53:03.13465009 +0000 UTC": month out of range
go playground:
2009-11-10 23:00:00 +0000 UTC parsed with error parsing time "2009-11-10 23:00:00 +0000 UTC" as "2009-07-10 23:00:00 +0000 UTC": cannot parse "9-11-10 23:00:00 +0000 UTC" as "009"
The text was updated successfully, but these errors were encountered:
Not a bug. The result of String is not a valid format.
Sorry, something went wrong.
No branches or pull requests
time.Parse can not parse the default format produced by time.String()
What version of Go are you using (
go version
)?go1.7.1 linux/amd64
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="$HOME/.local/share/go"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build766838131=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
What did you do?
https://play.golang.org/p/wmfQP5wX0S
What did you expect to see?
What did you see instead?
There were different out comes, local:
go playground:
The text was updated successfully, but these errors were encountered: