I am writing a Where clause to filter out a datetime column.
I get the time zone offset (e.g. -9.00 for US PST) and I want to filter all the items that are in the last x days.
This is what I still have. UserTimezone is the parameter that defines the user's time zone, and TheDays is the number of days we want to filter for
DateTime TheNow = DateTime.Now; TheNow = TheNow.AddHours(UserTimezone); DateTime TheSelectTime = TheNow; DateTime TheShift = - TheDays * 24; TheSelectTime = TheSelectTime.AddHours(TheShift); var TheQuery = from... where t.Appoint < TheSelectTime
If I write t.Appoint.Date <Then TheSelectTime.Date will not select based only on date, not time. What are your suggestions for resolving this issue?
source share