title: DATEADD() function to find values in this business day
body: <p>How can I use the SQL DATEADD() function to find a record from this business day? For example:</p>
  
  <pre><code>SELECT * FROM records r
  WHERE r.creationTime &lt;= GETDATE()
    AND r.creationTime &gt;= DATEADD(dd, -1 * hoursFromStartOfThisDay, GETDATE())
  </code></pre>
  
  <p>Where 'hoursFromStartOfThisDay' is exactly what it says.</p>
  
  <p>Note: I'm talking about business days so from 9am-5pm, Monday-Friday if that matters at all.</p>
  
  <p>Thanks, guys!</p>
  
  <p>Edit: I am also looking to apply a solution to this for the start of the beginning of the week/month and maybe hour too.</p>
  
  <p>Edit: So if a record was created at 18/07/2011 08:55:00 and another created at 18/07/2011 09:05:00, I want the second record to be picked up by the query and not the first. However if the current GETDATE() is 18/07/2011 09:15:00 then it gets tricky.</p>
  
  <p>how about adding <code>AND r.creationTime &gt;= '9am'</code>?</p>