獲取一週內的數據

獲取一週內的數據:     spa

1 DateTime givenDate = DateTime.Today;
2 DateTime startOfWeek = givenDate.AddDays(-1 * (int)givenDate.DayOfWeek);
3 DateTime endOfWeek = startOfWeek.AddDays(7);

EF獲取昨天的數據:code

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);
相關文章
相關標籤/搜索