xxxxxxxxxx
t := time.Now()
fmt.Println(t.Format("2006-01-02 15:04:05"))
// 2022-09-20 10:29:13
fmt.Println(t.Format("2006-01-02 00:00:00"))
// 2022-09-20 00:00:00
xxxxxxxxxx
t := time.Now() // 2022-09-20 10:29:13
// create new time and round down the time/day/month etc. as desired
rounded := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
fmt.Println(t.Format("2006-01-02 15:04:05"))
// 2022-09-20 10:29:13
fmt.Println(rounded.Format("2006-01-02 15:04:05"))
// 2022-09-20 00:00:00