I am trying to parse this string
"2017-06-01 11:22:20.683"
It is working just fine in Firefox, but return NaN in IE 11
Unfortunately I am unable to modify the source string since its coming from a legacy system.
function myFunction() {
var d = Date.parse("2017-06-01 11:22:20.683");
document.getElementById("demo").innerHTML = d;
}
<p id="demo"></p>
<button onclick="myFunction()">Try it</button>
Here is the simpliest solution:
function myFunction(dateString) {
var str = dateString.replace(/^(.*-[0-9][0-9])(\ )([0-9][0-9]\:.*$)/, '$1T$3')
var d = Date.parse(str);
document.getElementById("demo").innerHTML = d;
}