1
如何将日期列表返回到最近的分钟。我需要的LINQ查询只返回日期比赛所传递的日期到最近3分钟使用linq返回日期记录到最近的分钟
return EntitySet.Count(f => f.VISITDATE == dt.Date);
我用这样的代码通常是:
if((date2 - date1).Minutes <= 3) {
Console.WriteLine("Do not add again!!");
}
它改成变种result = EntitySet.Count(item => Math.Abs(((DateTime)item.VISITDATE - dt.Date).TotalMinutes)<= 3); – okenshield
使用'Count'而不是'Where'将返回日期数量而不是日期列表。 – Zen