Maybe like this: .Where( x => x.Date >= firstdate.Date && x.Date <= lastdate.Date )
.
How Can find Data between Two Date Using LINQ
i wan find data between two date. but all data can't display. only last two data find as result.
Date productID
2024-04-19 15:50:35.7510481 9
2024-04-19 15:50:35.7539253 10
2024-04-19 16:42:54.1178610 1
2024-04-19 16:42:54.1408529 2
2024-04-19 16:42:54.1440315 3
2024-04-19 16:42:54.1472743 4
2024-04-19 16:43:12.9145960 8
2024-04-19 16:43:12.9184212 9
2024-04-19 16:43:12.9218233 10
2024-04-19 20:18:29.3541375 8
2024-04-19 20:18:29.3805648 9
2024-04-19 20:18:29.3840899 11
2024-04-20 00:00:00.0000000 8
2024-04-20 00:00:00.0000000 9
var res=list.ToList().Where(x=>x.Date==firstdate && x.Date<=lastdate);
-
Viorel 112.5K Reputation points
2024-04-20T11:42:48.8466667+00:00