title: Cast datetime in the where clause of the query
body: <pre><code>SELECT *
  FROM tblClassAppointments
  INNER JOIN tblClassGroups ON tblClassAppointments.GroupID = tblClassGroups.GroupID
  WHERE (
          ('2015-07-13' &gt;= StartTime)
          AND ('2015-07-13' &lt;= EndTime)
          AND ('2015-07-13' &gt; StartTime)
          AND ('2015-07-13' &gt;= EndTime)
          )
      OR (
          ('2015-07-13' &gt;= StartTime)
          AND ('2015-07-13' &lt; EndTime)
          AND ('2015-07-13' &gt; StartTime)
          AND ('2015-07-13' &lt;= EndTime)
          )
      OR (
          ('2015-07-13' &lt;= StartTime)
          AND ('2015-07-13' &lt; EndTime)
          AND ('2015-07-13' &gt;= StartTime)
          AND ('2015-07-13' &lt;= EndTime)
          )
      OR (
          ('2015-07-13' &lt;= StartTime)
          AND ('2015-07-13' &gt;= EndTime)
          )
  </code></pre>
  
  <p>I use above query for getting class appointments which are placed for a  certain time period. I need to cast the <code>StartTime(tblClassAppointments.StartTime)</code> and <code>EndTime(tblClassAppointments.EndTime)</code> as <code>yyyy-mm-dd</code>.</p>
  
  <p><strong>What I tried :</strong></p>
  
  <p>I tried </p>
  
  <pre><code> CONVERT(char(10), StartTime, 126) 
  </code></pre>
  
  <p>and </p>
  
  <pre><code>CONVERT(char(10), EndTime, 126) 
  </code></pre>
  
  <p>instead of <code>StartTime</code> and <code>EndTime.</code> It gave an error.</p>
  
  <p><strong>What I need :</strong></p>
  
  <p>How I convert <code>StartTime</code> and <code>EndTime</code> as <code>yyyy-mm-dd</code> inside the where clause itself? (both the fields are in type of datetime)</p>
  
  <p>Please advice me. Thanks</p>