1.呼び出し側
t := r.PostFormValue("time") //2022-01-12 _time , error := Strtotime(t)
2.Strtotime 関数
func Strtotime(str string, layout string) (int64, error) { layout := "2006-01-02 15:04:05" s := strings.Replace(str[0:len(layout)], "T"," ",1); t, err := time.Parse(layout, s) if err != nil { return 0, err } return t.Unix(), nil }