Thursday, 29 May 2014

End Date must be greater than Start date in javascript

function compareDate()
{

var start = document.formName.begindate.value;
var end = document.formName.enddate.value;

var stDate = new Date(start);
var enDate = new Date(end);
var compDate = enDate - stDate;

if(compDate >= 0)
return true;
else
{
alert("Please Enter the correct date ");
return false;
}