-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: cannot parse GMT timezones with colon-separated offsets #9881
Comments
I apologize for not picking up this issue earlier, but it is now too late to fix for the 1.5 release: it would be unwise to change the internals of time.Parse and time.Format at this late date. I will mark it to be addressed early in the 1.6 release cycle. |
Unfortunate. The special handling of GMT, which is needed for other things, makes it very difficult to know whether the :10:00 should be considered part of the time zone or left alone to match the layout. |
A workaround I used in my project, in case anyone finds it useful - https://play.golang.org/p/EshUUdz-fz
outputs:
The regex will only affect timezones given in GMT, it won't affect say "UTC+08:00". |
go version
go version go1.4 linux/amd64
uname -a
Linux daniel-linux 3.16.0-28-generic #38-Ubuntu SMP Fri Dec 12 17:37:40 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
This program shows my attempt to parse the time: http://play.golang.org/p/2-YXz2wdIx
I've traced it to
src/time/format.go
, which consumes any integers following the lettersGMT
.The minutes (after the colon) then cause a parse failure.
Because the letters
GMT
are treated specially, I don't think it's possible to parse this time with thetime
package.The text was updated successfully, but these errors were encountered: