title: Cast and substring the Date time column in SQL Server
body: <p>I have a column <code>OFFSTARTIME</code> with a <code>datetime</code> datatype. Currently data is appearing as </p>
  
  <pre><code>1900-01-01 08:00:00.000
  </code></pre>
  
  <p>I want to show only </p>
  
  <pre><code>08:00:00
  </code></pre>
  
  <p>For that I have tried the following query:</p>
  
  <pre><code>SUBSTRING(CAST(OFFSTARTIME AS VARCHAR(19)), 12, 19)
  </code></pre>
  
  <p>but it's showing an output of</p>
  
  <pre><code>0 8:00AM
  </code></pre>