Using LINQ.Distinct () with DateTime - fetching only the first instance of a date
I am using EF and LINQ in my MVC 3 web application.
I have a request like this
var dates = timetableEvents.GroupBy(x => x.DateTimeStart).Distinct();
x.DateTimeStart
- date in this format:
23/01/2013 12:47:13 23/01/2013 14:00:10 23/01/2013 16:15:00 24/01/2013 02:05:00 24/01/2013 04:55:05 25/01/2013 06:00:00
I need a filter that only selects the first instance of a date.
How to do it?
23/01/2013 24/01/2013 25/01/2013
+3
source to share