0

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′));

Filed in: Java Scripts, Web Development Tips Tags: , , ,

Related Posts

Bookmark and Promote!

© 2012 Sumit Bansal. All rights reserved. XHTML / CSS Valid.