Date Difference in Days
May 17th, 2005 by Intermanaut
To use this, just call CountDays() with two properly formatted date values.
<script type=”text/javascript”>
<!–
function CountDays(StartDate,EndDate)
{
var StartMS=Date.parse(new Date(StartDate));
var DateMS=Date.parse((EndDate));
return parseInt(DateMS-StartMS)/86400000;
}
var StartDate=’May 01, 2001 00:00:00′;
var EndDate=’May 17, 2001 00:00:00′;
document.write (CountDays(StartDate,EndDate));
//–>
</script>