title: Convert yyyy-MM-dd to MM/dd/yyyy in javascript
body: <p>This might be a simple solution but I am stuck,  basically I need convert an incoming yyyy-MM-dd to MM/dd/yyyy also, if incoming date is nil, then output should also be nil.</p>
  
  <p>Incoming date could be of following format</p>
  
  <pre><code>2015-01-25 or nil
  </code></pre>
  
  <p>Output date shoud be</p>
  
  <pre><code>01/25/2015 or nil
  </code></pre>
  
  <p>I was trying one from the following link 
  <a href="https://stackoverflow.com/questions/25551322/convert-date-yyyy-mm-dd-to-mm-dd-yyyy">Convert Date yyyy/mm/dd to MM dd yyyy</a> but couldn't make it work.</p>
  
  <p>Thanks for any help.</p>
  
  <p>Forgot to mention, the incoming date which comes as nil is of the following format in an xml file</p>
  
  <pre><code>&lt;Through_Date__c xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/&gt;
  </code></pre>
  
  <p>So if I get the above format the output should be just be nil</p>