title: javascript date format into dd/mm/yyyy
body: <p>I have this bit of code:</p>
  
  <pre><code>&lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
      &lt;div&gt;
          &lt;asp:TextBox runat="server" ID="TextBox1" Text="10/20/2013" onchange="javascript:MyFunc();"&gt;&lt;/asp:TextBox&gt;
          &lt;asp:TextBox runat="server" ID="TextBox2" Text=""&gt;&lt;/asp:TextBox&gt;
      &lt;/div&gt;
      &lt;/form&gt;
      &lt;script type="text/javascript"&gt;
          function MyFunc() {
              MyTextBox = document.getElementById("&lt;%= TextBox1.ClientID %&gt;");
              MyTextBox2 = document.getElementById("&lt;%= TextBox2.ClientID %&gt;");
              var date = new Date(MyTextBox.value);
              var day = date.getDate();
              var month = date.getMonth() + 1;
              var year = date.getFullYear() + 1;
              MyTextBox2.value = day + "/" + month + "/" + year;
          }
      &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Which basically is 2 textboxes and when the first textbox date is updated the second textbox value becomes the date from textbox 1 + 1 year.</p>
  
  <p>The code works fine except for one issue. In Textbox1 the date must be in the US format mm/dd/yyyy which is wrong. 
  For example if I want to change 20/10/2013 into 20/10/2014 I must enter 10/20/2013 in the first textbox.</p>
  
  <p>How can I get it to work for dd/mm/yyyy?</p>