title: MS SQL Server equivalent of to_char
body: <p>In Redshift, we use below command for converting datetime to a formatted string as shown below- </p>
  
  <pre><code>to_char(&lt;any datetime column&gt;, 'MM/DD/YYYY HH:MI AM') AS dateTime
  </code></pre>
  
  <p>How can I achieve the same in MS SQL server. I used convert and cast but I cannot exactly format it the same way as above. I used </p>
  
  <pre><code>select convert(varchar(20),&lt;any datetime column&gt;,9)
  </code></pre>