I am using Appcelerator Titanium, and I'm trying to parse a date string as a new Date object and then use the .getTime()
function but it keeps returning "NaN"
var d = new Date("2014-02-01T00:00:00");
var time = d.getTime();
console.log(time); // returns NaN
Am I doing anything wrong here? It works when I create a new date for now, like this:
var d = new Date();
var time = d.getTime();
console.log(time); // returns correct value
I can't see why the first example is working but the second example is not.