Golang calculates the time distance
// The specified time is minutes away from the current time
// s1 := "2022-06-22 17:02:00"
func Zhiding(s1 string) int {
timeLayout := "2006-01-02 15:04:05"
loc, _ := time.LoadLocation("Local")
theTime, _ := time.ParseInLocation(timeLayout, s1, loc)
fenzhong := F2i(time.Until(theTime).Minutes())
return fenzhong
}
// F2i float to int
func F2i(f float64) int {
I, _ := strconv.atoi (fmt.Sprintf("%1.0f", f))
return i
}