title: Set new Date() with a string containing a date in UK format
body: <p>I want to be able to enter a UK formatted date when creating a new Date from a string, that will work in all modern browsers, but mainly FireFox and IE.</p>
  
  <pre><code>new Date('24/06/2014') // Gives 06/24/2014
  </code></pre>
  
  <p>Because I want to set a jquery datepicker using it.</p>
  
  <p>Is it possible to get</p>
  
  <pre><code>new Date()
  </code></pre>
  
  <p>to interpret a UK date passed as a string?</p>
  
  <pre><code>new Date('24/06/2014').toLocaleString("en-GB") // Gives 06/12/2015
  
  new Date('06/24/2014').toLocaleString("en-GB") // Gives 24/06/2014
  </code></pre>
  
  <p>The real problem is when I use the datepicker I specify UK date format and everything is fine...</p>
  
  <pre><code>$("#outOfStockFromDate").datepicker({
      dateFormat: 'dd/mm/yy',
  changeMonth: true,
  numberOfMonths: 3,
  onClose: function (selectedDate) {
      $("#to").datepicker("option", "minDate", selectedDate);
  }});
  </code></pre>
  
  <p>Until I try to repopulate the datepicker using this UK date format using something like...</p>
  
  <pre><code>$("#outOfStockFromDate").datepicker("setDate", testDate);
  </code></pre>
  
  <p>It's as if the string 'testDate' must be in US format... grrr</p>
  
  <p><strong>EDIT:</strong> I realise there are two parts to this question, the first part dealing with datepicker; it was my stupid fault that I was initialising it at the same time I was trying to setDate (this error led me down the Date() route). Now I have it initialised and changed correctly it accepts UK format dates!</p>
  
  <p>Second part yes the date functionality in javascript regarding formatting dates (now I know) is famously lacking... but as I've solved my initial problem I don't care about this one... P.S. I ended up splitting and reconstructing the date in US Date Format (in a string) then using new Date(USDateFormattedString).... and then I realised!</p>
  
  <p>So to end, essentially my code was correct in it's syntax, but in it's execution it was not.</p>
  
  <p>Thanks to everyone who answered! +1</p>