title: Convert Date to String in format dd-mmm-yyyy
body: <p>I am new to js and I am trying to fiddle with the javascript dates.
  I have a following date in the format 01-JAN-2016 and I need to subtract 1 day from it.
  I tried </p>
  
  <pre><code>var dateVar = '01-JAN-2016'
  var d = new Date(dateVar);
  alert(d);
  alert(d-1);
  </code></pre>
  
  <p>It gives me a date and time in long no. But I want it want it to be '31-DEC-2016'
  How can I add the format dd-MMM-yyy to it?</p>