Q:

C# GroupBy 30 minute interval returning incorrect result

I am using Highcharts to give visual displays of information. As of right now, I am grouping all of the database table records by the hour:
var lstGroupSummariesByHour =
    lstAllSummaries.Where(x => x.DateTimeProperty.Year == year && !x.deleted)
        .GroupBy(x => x.DateTimeProperty.Hour)
        .Select(x => new object[] {x.Count()}).ToArray();

This is one line on my line chart.. but I am looking to create a new line where it shows all summaries for every half hour. Is there a simple LINQ lambda way to achieve this?
According to the this question if I wanted 30 minute intervals my code would look something like this since in the second answer he divides the minute by 12 to get 5 minute intervals?
var lstGroupSummariesByHalfHour =
    lstAllSummaries.Where(x => x.DateTimeProperty.Year == year && !x.deleted)
        .GroupBy(
            x =>
                new DateTime(x.DateTimeProperty.Year, x.DateTimeProperty.Month, x.DateTimeProperty.Day, x.DateTimeProperty.Hour,
                    x.DateTimeProperty.Minute / 2, 0))
        .Select(x => new object[] {x.Count()}).ToArray();

This is returning right under 3500 records which is causing a Highcharts error of not enough ticks on the X-Axis.. which is 0 through 24 (based on hour).. so shouldn't it be returning 48 since there are 48 half-hours in a day? 24 * 2 (which would still return the highcharts error, but I will deal with that later)?
How do I fix the code above to get results for every half hour?
UPDATE
What I'm looking for (for example), is how many summaries are between 0100 & 0130, 0131 - 0200, 0201 - 0230.. and so on and so on.
Here is what my graph currently looks like:

I want to get the count of summaries for the tick that is in between each number (Hour).. 0030.. 0130.. 0230..
My graph currently is based on the entire year.. so throughout the year.. 'x' number of summaries during the 0 hour.. 'y' number of summaries during the 1 hour.. and so on and so on.. so I'm looking for a total count of number of summaries for the entire year that happened between 0000 - 0030, 0031-0100, 0101 - 0130.. and so on and so on.

A:

you need to quantize the minutes to either 0 or 30
new DateTime(
  x.DateTimeProperty.Year, 
  x.DateTimeProperty.Month, 
  x.DateTimeProperty.Day, 
  x.DateTimeProperty.Hour, 
  x.DateTimeProperty.Minute > 30 ? 30 : 0,
  0));

