x.CreateDate
的DateTime
数据存储在我们的数据库中,包括毫秒。我的dateTimePicker值“开始日期”和“结束日期”只允许查询到秒。
如何更改我的查询以忽略x.CreateDate
的毫秒?我以为我下面写的代码会起作用,但实际上并没有。
if (stardDateIsValid && endDateIsValid && startdate == enddate)
query = _context.Logs
.Where(x => x.ApplicationID == applicationId &&
x.CreateDate.AddMilliseconds(-x.CreateDate.Millisecond) == startdate)
.OrderByDescending(x => x.ID)
.Take(count);
startdate
是什么格式? - Tim Freese