I have two dates in format 14-May-2013 and 15-Jun-2013
How can I compare this two dates?
This is the code I have, but it doesn't seem to be working fine.
if (col == 8 && m == 2) {
var firstValue = document.getElementById(tableID+m+""+6).innerHTML.split('-');
var secondValue = document.getElementById(tableID+m+""+7).innerHTML.split('-');
var firstDate=new Date();
firstDate.setFullYear(firstValue[0],firstValue[1], firstValue[2]);
var secondDate=new Date();
secondDate.setFullYear(secondValue[0],secondValue[1], secondValue[2]);
if (firstDate < secondDate)
{
alert("First Date is less than Second Date");
}
else
{
alert("Second Date is less than First Date");
}
}
What am I doing wrong and how do I make it work right?
Thanks!