LINQ. Grouping by days. How to do this easily?

Posted by punkouter on Stack Overflow See other posts from Stack Overflow or by punkouter
Published on 2010-06-16T21:39:09Z Indexed on 2010/06/16 21:42 UTC
Read the original article Hit count: 134

Filed under:
|
|

I can't seem to find any god reference on this. I have alot of data in SQL with dates. So I wanted to make a line chart to show this data over time. If I want to show it over a perioud of days then I need to group by days.. But the LOGDATE is the full date.. not the DAY..

So I have this below.. but LINQ doesnt know what 'DayOfYear' property is.. HELP

 var q = from x in dc.ApplicationLogs
                let dt = x.LogDate
                group x by new { dayofyear = dt.Value.DayOfYear } into g
                select new
                {
                    iCount = g.Count(),
                    strDate = g.Key
                };

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about date