Reputation: 1480
I have a table of events, I need a linq query that will return all events from a certain month and year, not day.
something like
var monthquery = from c in db.events
where c.startdate.month == DateTime(MonthValue, Year Value)
select c;
I just don't know the syntax. What do I put in instead of MonthValue to get July, for instance?
Thanks in advance
Upvotes: 0
Views: 567
Reputation: 12025
Instead of MonthValue, you can put the integer that represents the month ...
var monthquery = from c in db.events
where c.startdate.month == IntegerThatRepresentTheMonth
&& C.startDate.Year == IntegerThatRepresentTheYear
select c;
Upvotes: 3