我想从今天的代码中获取今天的记录。但是,除非我在linq中添加一天,否则它将返回昨天的记录。但DateTime.Now.Day正确显示。什么地方出了错。
var data = from s in db.SalesItems
where (
s.Date.Year == DateTime.Now.Year &&
s.Date.Month == DateTime.Now.Month &&
s.Date.Day == DateTime.Now.Day+1
)
select s;
ViewBag.StatusMessage = data.FirstOrDefault().Date + " " + DateTime.Now.Day;
StatusMessage =" 20/05/2014 12:07:57 PM 20"