0

I'm trying to compare just the date of a column but because the query below is also comparing the time I get no result set back.

How could I write this same LINQ query if I'm only interested in the actual date value matching?

The column "ImportDate" has a value that looks similar to this 2009-08-30 12:26:00

from t in UnitsOfWork _
where t.ImportDate = "08/30/2009" _
select t
Toran Billups
  • 27,111
  • 40
  • 155
  • 268

1 Answers1

4

You can compare it as a string or you can use just the Date property on ImportDate

where t.ImportDate.ToString("yyyyMMdd") == "20090830"

or

where t.ImportDate.Date == new DateTime(2009,8,30)
tvanfosson
  • 524,688
  • 99
  • 697
  • 795