110,535
社区成员
发帖
与我相关
我的任务
分享
var list=new list<datetime>();
var start=datetime.parse("");
var end=datetime.parse("");
while(start.tostring("yyyy-MM-dd")!=end.tostring("yyyy-MM-dd"))
{
start.adddays(1);
list.add(start);
}
var 有效天=list.count(d=>d.tostring("yyyy-MM")=="2019-12");
DateTime dtStart = DateTime.Parse("2019-11-12");
DateTime dtEnd = DateTime.Parse("2019-12-25");
List<DateTime> listDt = new List<DateTime>();
int days = (dtEnd - dtStart).Days;
for (int i = 0; i <= days; i++)
{
listDt.Add(dtStart.AddDays(i));
}
int count = listDt.Count(d => d.Month == 12);