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

month out of range #43641

Closed
mrwangchao opened this issue Jan 12, 2021 · 1 comment
Closed

month out of range #43641

mrwangchao opened this issue Jan 12, 2021 · 1 comment

Comments

@mrwangchao
Copy link

mrwangchao commented Jan 12, 2021

go version go1.13.3
code:

package main

import (
    "fmt"
    "time"
)

func main() {
    Fpublic_time_str := "2019-03-19"
    timeLayout := "2006-01-01"           //转化所需模板
    loc, _ := time.LoadLocation("Local") //获取时区
    tmp, err := time.ParseInLocation(timeLayout, Fpublic_time_str, loc)
    fmt.Printf("%v, %v,%v\n", tmp, Fpublic_time_str, err)
    Fpublic_time := int(tmp.Unix()) //转化为时间戳(秒级) 类型是int64

    fmt.Printf("%d\n", Fpublic_time)
}

output:
0001-01-01 00:00:00 +0000 UTC, 2019-03-19,parsing time "2019-03-19": month out of range

@davecheney
Copy link
Contributor

Thank you for raising this issue. Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For asking questions, see:

@golang golang locked and limited conversation to collaborators Jan 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants