I have a date like this :
var intervalStart="13-11-2014 16:22:00"
and an epoch time like this :
1415876254
I need to convert the string date into epoch to compare the two! Am kind of lost here. I looked at the other answers and by using :
var formattedDays = intervalStart.split(" ")[0].split("-");
var epoch = new Date(formattedDays[2], formattedDays[1] - 1, formattedDays[0]).getSeconds;
I tried something like this too :
var formattedDays = intervalStart.split(" ")[0].split("-");
var formattedTime = intervalStart.split(" ")[1].split(":");
var epochStart = new Date(formattedDays[2], formattedDays[1] - 1,formattedDays[0],formattedTime[0],formattedTime[1],formattedTime[2],0).getTime()/1000;
^ But this seems to be giving numbers like 16 etc!!
I can get the seconds for upto days("13-11-2014") correctly but how do i include time("16:22:00") here?Thanks a lot in advance!
P.S : I do not want to use some external library . And I would prefer no regex !