title: Format Date in dd.MM.yyyy
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3605214/javascript-add-leading-zeroes-to-date">Javascript add leading zeroes to date</a>  </p>
  </blockquote>
  
  
  
  <p>It might be a simple question because I am still <em>newbie</em> in JavaScript, assume I have DateTime in ISO format:</p>
  
  <pre><code> 2012-07-07T17:00:00
  </code></pre>
  
  <p>I would like to format this date to string:</p>
  
  <pre><code> 07.07.2012
  </code></pre>
  
  <p>I have written a function to format to 7.7.2012 as below:</p>
  
  <pre><code>var formatDate = function (datum) {
      var date = new Date(datum);
      return date.getDate() + '.' + (date.getMonth() + 1) + '.' + date.getFullYear();
  };
  </code></pre>
  
  <p>How can I modify this code to get the result <code>07.07.2012</code> instead of <code>7.7.2012</code></p>