Simplest way to parse a Date in Javascript

javascript

Solution

There are lots of libraries and copy-and-paste javascript snippets on the net for this kind of thing, but here is one more.

function dateParse(s) {
  var parts = s.split('/');
  var d = new Date( parts[2], parts[1]-1, parts[0]);
  return d;
}

Problem

I want to parse a Date chosen by user: ``` var ds = "11 / 08 / 2009"; ``` I use ``` var d = new Date(ds); ``` It gives me November, 08, 2009. But what I need is August, 11, 2009. What is the simplest way to parse the date?

Original source