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
你能试一下吗
var dates = timetableEvents.GroupBy(x => x.DateTimeStart.Date).Distinct();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.