I am trying to get the week of a date from the database and compare it to a user selected value from a DateTimePicker. My users can select a day and I wrote a class that gives me the week of that day in the form 1 to 52. I am trying to select get LINQ to compare the weeks of a given date from the database to the week selected by the user. Example:
var report = (from orders in Context.Orders
where DateEx.ISOWeekNumber(orders.Date) ==
DateEx.ISOWeekNumber(datepicker1.Value)
select orders);
But it is not working at all as LINQ doesn’t have a translation for the ISOWeekNumber.
Anyone knows how I can do this?
What about something of the ilk?
Giving you:
Hope that helps,
Dan
Probably take Math.Truncate(date.DayOfYear/7) into your new DateEx class