I tried to parsing string to time in go, here is what I've done:
dateTime := fmt.Sprintf("%s %s CST", dateValue, timeValue)
date, err := time.Parse("2006-1-2 150405 MST", dateTime)
I got the following error message:
parsing time "2012-4-9 174031 CST" as "2006-1-2 150405 MST": cannot parse "2012-4-9 174031 CST" as "2006"
From the error message, it shows the dateTime value I passed in is correct. I also tried to do the following, it works fine:
dateTime := "2012-4-9 174031 CST"
date, err := time.Parse("2006-1-2 150405 MST", dateTime)
This is bothering me for a few days. Could anybody help to point out where is the mistake? Thanks!
dateValueandtimeValuetoo.fmt.Sprintf("%s %s CST", dateValue, timeValue) == "2012-4-9 174031 CST"and post the result.