func main() {
fmt.Println(splitDate("2021-03-09", "2021-04-06", "2006-01-02"))
}
func splitDate(beginDate, endDate, format string) []string {
bDate, _ := time.ParseInLocation(format, beginDate, time.Local)
eDate, _ := time.ParseInLocation(format, endDate, time.Local)
day := int(eDate.Sub(bDate).Hours() / 24)
dlist := make([]string, 0)
dlist = append(dlist, beginDate)
for i := 1; i < day; i++ {
result := bDate.AddDate(0, 0, i)
dlist = append(dlist, result.Format(format))
}
dlist = append(dlist, endDate)
return dlist
}