Summarize some common functions of golang
/**************** data type ****************/
//1.parse int to string
var number int = 100
strconv.Itoa(number) //string
//2.parse string to int
var timeStamp string = 1500000
timeStampInt, err := strconv.Atoi(timeStamp)
if err != nil {
glog.Errorf("Change timeStamp to int error: %v", err)
return
}
/**************** time ****************/
//1.parse string to time format
timeString := "2018-07-03 14:50:02"
time, err := time.Parse("2006-01-02 15:04:05", timeString)
if err != nil {
glog.Errorf("Parse time error: %v", err )
return
}
//2.parse time to string format
timeStr := time.Format("20060102")