Get list of (floored) hours between two DateTimes
<p>I wrote a function to inclusively give me a list of hours that fall between two <code>DateTime</code>'s.</p>

<p>But in the end it doesn't really look very easy to read and it makes me want to unit test it even though the project I'm working on doesn't unit test at all.</p>

<p>So my question is, is there a more legible and or efficient way to write this?:</p>

<p>Code:</p>

<pre><code>private List&lt;DateTime&gt; GetHoursForEvent(DateTime start, DateTime end)
{
    var hours = new List&lt;DateTime&gt;();

    DateTime startFloor = Convert.ToDateTime(start.ToString("MM/dd/yyyy HH:00:00"));
    DateTime endFloor = Convert.ToDateTime(end.ToString("MM/dd/yyyy HH:00:00"));

    for (double dblDate = startFloor.ToOADate(); 
         dblDate &lt;= endFloor.ToOADate(); 
         dblDate += (1.0 / 24.0))
    {
        hours.Add(DateTime.FromOADate(dblDate));
    }

    return hours;
}
</code></pre>

<p>Input:</p>

<pre><code>DateTime start = Convert.ToDateTime("2012-04-01 04:22:00");
DateTime end   = Convert.ToDateTime("2012-04-02 00:05:00");
</code></pre>

<p>Result:</p>

<pre><code>2012-04-01 04:00:00
2012-04-01 05:00:00
2012-04-01 06:00:00
2012-04-01 07:00:00
2012-04-01 08:00:00
2012-04-01 09:00:00
2012-04-01 10:00:00
2012-04-01 11:00:00
2012-04-01 12:00:00
2012-04-01 13:00:00
2012-04-01 14:00:00
2012-04-01 15:00:00
2012-04-01 16:00:00
2012-04-01 17:00:00
2012-04-01 18:00:00
2012-04-01 19:00:00
2012-04-01 20:00:00
2012-04-01 21:00:00
2012-04-01 22:00:00
2012-04-01 23:00:00
2012-04-02 00:00:00
</code></pre>

<p>I get the feeling i'm reinventing the wheel.</p>
