I use EF and LINQ in my MVC 3 web app.
I have a query like this
var dates = timetableEvents.GroupBy(x => x.DateTimeStart).Distinct();
x.DateTimeStart
are 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 to have the filter which select only the first instance of a date.
How to do it?
23/01/2013
24/01/2013
25/01/2013
Can you try
var dates = timetableEvents.GroupBy(x => x.DateTimeStart.Date).Distinct();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With