title: Convert Date from one format to another format in JavaScript
body: <p>I have a string of a date in javascript in format #1. I need to convert it to format #2.</p>
  
  <p>The problem starts when one format is "dd/mm/yy" and the other is "mm/dd/yy".</p>
  
  <p>The formats change dynamically and I have the formats as strings, but I need a function like</p>
  
  <pre><code>   Date newDate = convert(currentDate, currentFormatString, newFormatString).
  </code></pre>
  
  <p>How can I do it?</p>