I have a string that has a timestamp in the format
"2021-02-04 23:45:00" but when I try and parse this with time.parse it seemingly cuts off the year part.
The code is
case "period_end":
fmt.Println(record[i])
ts, err := time.Parse("2021-02-04 23:45:00", record[i])
if err != nil {
log.Printf("Time conversion failed: %v", err)
return
}
reading.Interval = t
where record[i] at this point is a string with
2021-02-04 00:15:00
and reading.Interval is time.Time
The error returned in the Printf is
Time conversion failed: parsing time "2021-02-04 00:15:00" as "2021-02-04 23:45:00": cannot parse "-02-04 00:15:00" as "1"
which I can't find in any search I've done. What am I missing here?