How to check date if date is between two date

This function the return the true and false if date is exist or not exist.

function dateWithin(StartDate,EndDate,CheckDate) {
var b,e,c;
s = Date.parse(StartDate);
e = Date.parse(EndDate);
c = Date.parse(CheckDate);
if((c <= e && c >= s)) {
return true;
}
return false;
}

// This will alert ‘false’

if(dateWithin(’12/20/2007′,’12/20/2007′,’12/20/2007′))
alert(dateWithin(’12/20/2007′,’12/20/2007′,’12/20/2007′));

Share This Post

Post Comment