我正在尝试解析时间值(通过电子邮件接收),但我找不到应该使用的布局。
package main
import "fmt"
import "time"
func main() {
layout := "Mon, _2 Jan 2006 15:04:05 -0700 (MST-07:00)"
data := "Mon, 5 Oct 2015 00:24:08 +0800 (GMT+08:00)"
t, err := time.Parse(layout, data)
if err != nil {
panic(err)
}
fmt.Println(t)
}
panic: parsing time "Mon, 5 Oct 2015 00:24:08 +0800 (GMT+08:00)" as "Mon, _2 Jan 2006 15:04:05 -0700 (MST-07:00)": cannot parse ":00)" as "-07:00"
慕莱坞森
慕运维8079593
相关分类