this way you can find the difference of two dates in JS.
var Days = Math.floor((Date2.getTime() - Date1.getTime())/(1000*60*60*24));
in php you can use this code ...
$startTimeStamp = strtotime("2011/07/01"); $endTimeStamp = strtotime("2011/07/17"); $timeDiff = abs($endTimeStamp - $startTimeStamp); $numberDays = $timeDiff/86400; // 86400 seconds in one day // and you might want to convert to integer $numberDays = intval($numberDays);
source share