I have a string with a specific format which I am trying to convert to a Date object. I was hoping var dateObject = new Date(myString) would be sufficient but it won't work. So I tried breaking up the string into smaller pieces, and that didn't work either.
var str = '2015-02-20 11:00';
var obj = new Date(str.substr(2, 4), str.substr(5, 7), str.substr(8, 10), str.substr(13, 15), str.substr(16, 18));
// Above code yields invalid date
How can I make a date object out of my string?