title: Javascript add leading zeroes to date
body: <p>I've created this script to calculate the date for 10 days in advance in the format of dd/mm/yyyy:</p>
  
  <pre><code>var MyDate = new Date();
  var MyDateString = new Date();
  MyDate.setDate(MyDate.getDate()+10);
  MyDateString = MyDate.getDate() + '/' + (MyDate.getMonth()+1) + '/' + MyDate.getFullYear();
  </code></pre>
  
  <p>I need to have the date appear with leading zeroes on the day and month component by way of adding these rules to the script. I can't seem to get it to work.</p>
  
  <pre><code>if (MyDate.getMonth &lt; 10)getMonth = '0' + getMonth;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>if (MyDate.getDate &lt;10)get.Date = '0' + getDate;
  </code></pre>
  
  <p>If someone could show me where to insert these into the script I would be really appreciative.</p>