1.処理
年と月の文字を、MariaDBのcolumnで定義した時間型に変換する
2.step
(1) yearとmonthの文字をPostFormValueで取り出す
(2) MariaDBのcolumnの時間型に、FORMATを指定して変換
3.code
const DATE_FORMAT = "2006-01-02 15:04:05";
year ,_ :=strconv.Atoi(r.PostFormValue("year"));
month ,_ :=strconv.Atoi(r.PostFormValue("month"));
start := time.Date(year, time.Month(month), 1, 0, 0, 0, 0, time.Local).Format(DATE_FORMAT)
end := time.Date(year, time.Month(month+1), 1, 0, 0, 0, 0, time.Local).Format(DATE_FORMAT)
fmt.Println(year, month);
fmt.Println(start, end);
4.結果
2021 10 2021-10-01 00:00:00 2021-11-01 00:00:00