title: Javascript date - Leading 0 for days and months where applicable
body: <p>Is there a clean way of adding a 0 in front of the day or month when the day or month is less than 10:</p>
  
  <pre><code>var myDate = new Date();
  var prettyDate =(myDate.getFullYear() +'-'+ myDate.getMonth()) +'-'+ myDate.getDate();
  </code></pre>
  
  <p>This would output as:</p>
  
  <pre><code>2011-8-8
  </code></pre>
  
  <p>I would like it to be:</p>
  
  <pre><code>2011-08-08
  </code></pre>