1 2 3 4 5 6 7 8 9 10 11
| func timeToTimestamp(date string) int64 { loc,_ := time.LoadLocation("Asia/Shanghai") tt,_ := time.ParseInLocation("2006-01-02 15:04:05",date,loc) return tt.Unix() }
func timestampTotime(date int64) string { tm := time.Unix(date,0) str := tm.Format("2006-01-02 15:04:05") return str }
|