title: converting date to DD-MMM-YYYY format
body: <p>I'm using following line of code in SQL:</p>
  
  <pre><code>REPLACE(CONVERT(VARCHAR(11),getdate(),106), ' ','-') 
  </code></pre>
  
  <p>to convert given date to <code>MMM-DD-YYYY</code> format, this code is working perfectly fine if current date is more that 10th. </p>
  
  <p>But I'm getting error when its tries to convert single digit date, e.g when I'm converting date <code>9 jan 2014</code>. It is converted to <code>Jan--9-2014</code>.</p>
  
  <p>Which is actually wrong as its contain one extra <code>-</code>. </p>
  
  <p>Please help me to resolve this issue.</p>