Why following code is not work ?
var date = new Date("31/01/2015"); // => return "Invalid Date" alert(date); How can I get Date object from string ?
Why following code is not work ?
var date = new Date("31/01/2015"); // => return "Invalid Date" alert(date); How can I get Date object from string ?
var date = new Date( Date.parse("2015/01/31") ); alert( date ); You need this format: YYYY/MM/DD. Then you can use Date.parse() https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse