title: Converting datetime format to 12 hour
body: <p>I have this query </p>
  
  <pre><code>select CONVERT(varchar(5), tdate ,108) AS [Time] from table 
  </code></pre>
  
  <p>which gives me the time in 24 hour format( military)</p>
  
  <p>I wanted to convert it into a 12 hour format so i tried the query below</p>
  
  <pre><code> select SUBSTRING(CONVERT(VARCHAR, tdate, 100),13,2) + ':' 
  + SUBSTRING(CONVERT(VARCHAR, tdate, 100),16,2) + ''
  + SUBSTRING(CONVERT(VARCHAR, tdate, 100),18,2) AS T  
  from table
  </code></pre>
  
  <p>and i get the 12 hour format but I am just curious if there is a shorter or better way of doing it. any help?</p>