Selecting transactions based on Date Range
<p>I'm faced with an issue where my application is doing a search for transactions based on a FROM and TO date. </p>

<p>Lets use the following example: </p>

<blockquote>
  <p>TRANS1: 14-Feb-2012 2:23:36</p>
  
  <p>TRANS2: 07-Feb-2012 3:23:47</p>
</blockquote>

<p>My date ranges in C# is as follow: </p>

<blockquote>
  <p>startDate.Date    {7/02/2012 12:00:00 AM}</p>
  
  <p>endDate.Date  {14/02/2012 12:00:00 AM}</p>
</blockquote>

<p>The following line of code will ALWAYS exclude transactions if they fall on the endDate because the endDate is always set to 12:00:00AM (Based on DateTime.Now)</p>

<pre><code>if (trans.TransactionDate &gt;= startDate.Date &amp;&amp;
                                   trans.TransactionDate &lt;= endDate.Date)
{
   // do stuff
}
</code></pre>

<p>How do I correctly handle this so that it includes all transactions for the 14th as well? Is it safe to do the following:</p>

<p>Changing 12:00:00AM to 12:00:00PM</p>

<pre><code>if (trans.TransactionDate &gt;= startDate.Date &amp;&amp; 
                     trans.TransactionDate &lt;= endDate.Date.AddHours(12))
{
   // do stuff
}
</code></pre>
