public List<string> GetData(int year,int month)
{
List<string> list = new List<string>();
DateTime date = new DateTime(year, month, 1);
int firstWeekDate = 1;
for (int i = 1; i <= date.AddMonths(1).AddDays(-1).Day; i++)
{
if (new DateTime(date.Year, date.Month, i).DayOfWeek == DayOfWeek.Monday)
{
firstWeekDate = i;
string temp = new DateTime(year, month, i).ToString("yyyy-MM-dd") + "~" + new DateTime(year, month, i).AddDays(6).ToString("yyyy-MM-dd");
list.Add(temp);
}
}
return list;
}
温馨提示:答案为网友推荐,仅供参考