golang/go

time: support parsing and formatting timestamps that don't use period for fractional seconds

theckman opened this issue · 3 comments

What version of Go are you using (go version)?

go version go1.10.1 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/theckman/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/theckman/go/"
GORACE=""
GOROOT="/Users/theckman/.gimme/versions/go1.10.1.darwin.amd64"
GOTMPDIR=""
GOTOOLDIR="/Users/theckman/.gimme/versions/go1.10.1.darwin.amd64/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/f5/zjcsdkrx2bxdm32zzqfg5yp80000gn/T/go-build809411951=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

https://play.golang.org/p/TEo-WL4gGsq

What did you expect to see?

I expected to be able to use either 2006-01-02 15:04:05,999 or 2006-01-02 15:04:05,000 to parse a timestamp like 2018-06-15 18:12:22,013. Especially as some written languages / countries use , to indicate fractions instead of ..

What did you see instead?

An error indicating that 013 could not be parsed in to ,999.

Looks similar to #6189

Let's close that one as a duplicate for #6189.

Rightly noted. Closing it then. Please shout if it's a mistake.