This really could use a better error message, though it's unclear how to
achieve that while still meeting Go 1 compatibility guarantees. Givenhttp://play.golang.org/p/5nALeDw-IJ
(2007 in the format string instead of
2006), it seems the format is parsed as `<1 digit day><3 digit offset><2
digit month><2 digit day>...` -- both the day and offset are recognized
twice, while the year isn't recognized at all. While technically
legitimate, intentional uses of a format like this would be exceedingly
rare; we could check this in go vet, if not done already, but few of the
people who've run into this issue know about or use vet.
If error messages are not covered by the Go 1 guarantee, then if a date
string parse error occurs, and the format string contains duplicate or
undelimited, odd sequences of fields, then the error message could be
expanded to indicate that the format date must correspond to the reference
On Wednesday, December 18, 2013 6:51:29 AM UTC-7, luz...@gmail.com wrote: On Tuesday, December 17, 2013 7:22:44 PM UTC+1, Alexandru Ungur wrote:http://play.golang.org/p/7J_Eii3RDI
Trying to learn about time parsing.
Played with some simple examples, but I just can't figure out how to
parse this one: "2012-12-05 23:00:34 +0200". The error I get is "parsing
time "2012-12-05 23:00:34 +0200": month out of range".
Sample here code here: http://play.golang.org/p/tvPekI8AVS
Any ideas, pointers, etc. greatly appreciated. Nor 12 neither 05 seem
like out of range for a month (unless months are counted from 0?).
The layout must be the reference date/time:
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to email@example.com.
For more options, visit https://groups.google.com/groups/opt_out.