I want to convert a string time "2019-06-20 13:30:31"
to int 20190620
, I tried with below codes, but I got 10190101
instead, what's wrong with my trial?
func (u *Util) ConvertStringTimeToInt(stringTime string) (intTime int64) {
timeLayout := "2019-01-01 01:01:01"
timeOutput := "20190101"
tmp, _ := time.Parse(timeLayout, stringTime)
out := tmp.Format(timeOutput)
outInt, _ := strconv.ParseInt(out, 10, 64)
return outInt
}