获取一周内的数据
获取一周内的数据:
1 DateTime givenDate = DateTime.Today; 2 DateTime startOfWeek = givenDate.AddDays(-1 * (int)givenDate.DayOfWeek); 3 DateTime endOfWeek = startOfWeek.AddDays(7);
EF获取昨天的数据:
DateTime sdt = DateTime.Now.Date.AddDays(-2); DateTime dt = DateTime.Now.Date.AddDays(-1); model.YesterdayOrderCount = orderQuery.Count(p => p.SuccessTime >= sdt && p.SuccessTime <= dt);