I am trying to parse time from string to time.Time type. I have following code:
s, _ := v.(string)
fmt.Println(s) //Gives: 2016-12-01T14:10:12Z
ttime, err := time.Parse("2006-01-01T07:00:00Z", s)
fmt.Println(err) //Gives: parsing time "2016-12-01T14:10:12Z" as "2006-01-01T07:00:00Z": cannot parse "14:10:12Z" as "T07:00:00Z
When I try change time layout:
s, _ := v.(string)
fmt.Println(s) //Gives: 2016-12-01T14:10:12Z
ttime, err := time.Parse("2006-01-01 07:00:00Z", s)
fmt.Println(err) //Gives: parsing time "2016-12-01T14:10:12Z": month out of range
Can someone tell me what I am doing wrong? Thanks for all answers.