Comparing Dates in LINQ and C#
Posted
by Redburn
on Stack Overflow
See other posts from Stack Overflow
or by Redburn
Published on 2010-05-03T05:13:45Z
Indexed on
2010/05/03
5:18 UTC
Read the original article
Hit count: 756
I have a LINQ query which checks to see if there are any tests done since the beginning of the year.
var MetersTestedCount = (from n in _mttDomainContext.MTTMeterTests
where n.TestDate > DateTime.Parse("1/1/2010")
select n.TestDate).Count();
This query however returns an empty set. I have a similar SQL query which pulls some records,
USE MeterTestTracking
Select * From MTTMeterTest
WHERE TestDate > '1/1/2010'
I have been to the previous posts. Even though similar, still no help:
How to compare just the date, not the timestamp using LINQ
and
What's the correct way to check dates in LINQ to return a dataset?
© Stack Overflow or respective owner