In a table i have stored alot of datetimes for when a certain action was taken. The data looks like this:
2012-05-01 14:30:29.8666925
2012-05-01 14:31:58.5422081
2012-05-01 14:35:38.3120864
2012-05-02 06:08:34.6322227
2012-05-02 06:08:54.0864203
2012-05-02 07:31:24.7269620
etc..
What i want to do is count how many times an action was taken per day. So the result i want is:
2012-05-01 = 3
2012-05-02 = 3
I tried to group the dates together, but it also takes the 'time' into account when grouping. I do need this data in my database, but not when grouping because i only want to look at it per day. Not per second.
This is what i have so far, but i'm not sure how to get the results i actually want.
var actions = (from a in entities.Actions
group a by a.Date
into g
select new
{
Actions = g.Count() // Not sure if this line is right...
});
Anyone any idea how to do this?