Skip to content
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: Parse date wrong? #12335

Closed
xpbliss opened this issue Aug 26, 2015 · 1 comment
Closed

time: Parse date wrong? #12335

xpbliss opened this issue Aug 26, 2015 · 1 comment

Comments

@xpbliss
Copy link

@xpbliss xpbliss commented Aug 26, 2015

aa:="2015-8-2" //or 2015-08-2, or 2015-8-02
t1, er1 := time.ParseInLocation("2006-01-02", aa, time.Local)
if er1 != nil {
    fmt.Println("parse date wrong!")            //it will be wrong.
}

but if the aa is "2015-08-02", it's ok.

@adg
Copy link
Contributor

@adg adg commented Aug 26, 2015

"2015-8-2" is not in the format of "2006-01-02", it is "2006-1-2". So the function is working as intended.

@adg adg closed this Aug 26, 2015
@mikioh mikioh changed the title Parse date wrong? time: Parse date wrong? Aug 29, 2015
@golang golang locked and limited conversation to collaborators Sep 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.