private void GetDataTimeInterval(DateTime begin_time, DateTime end_time, ref List<string> list) { list.Add(begin_time.ToShortDateString()); if (begin_time.ToShortDateString() != end_time.ToShortDateString()) { begin_time = begin_time.AddDays(1); GetDataTimeInterval (BEGIN_TIME, END_TIME, REF List); // return time interval list GetDataTimeInterval
}
}
transfer:
List<string> list = new List<string>();
GetDataTimeInterval(Convert.ToDateTime(begin_date), Convert.ToDateTime(end_date), ref list);
At this time, the returned list is intermediate two dates
For example GetDataTimeInterval (2019-07-01,2019-0704), ref list);
Returned list includes: 2019-07-01,2019-07-02,2019-07-03,2019-07-4