title: Javascript/jquery converting string to datetime (using New date in javascript) to pass to .net MVC
body: <p>I need to convert my string to a date format to pass it in a way that my mvc c# understands it.</p>
  
  <p>Please read the following, where I explain the problem step by step.</p>
  
  <p>I have an input</p>
  
  <pre><code>&lt;input name="EgresoStJohns" class="form-control txtOut"/&gt;
  </code></pre>
  
  <p>When the user saves the form, I do the following in Jquery</p>
  
  <pre><code>var dateOut = $(".txtOut").val();
  </code></pre>
  
  <p>dateOut becomes something like this, depending on the date that the user picks: 30/03/2017</p>
  
  <p>Then I try to parse my date, so the controller in c# mvc understands that I want to send a dd/mm/yy, otherwise, if I send 30/03/2017 the controller will understand month=30 and it will conver the entire date to null.</p>
  
  <pre><code>var DateToSend = new Date(parseInt(dateOut));
  DateToSend = DateToSend.getDate() + "/" + (DateToSend.getMonth() + 1) + "/" + DateToSend.getFullYear();
  </code></pre>
  
  <p>However, inmmediately after doing the New Date, the input ALWAYS becomes "31/12/1969", so I am unable to work with it.</p>
  
  <p>What can I do to solve this inconvenience? </p>