Monday, 4 November 2013

PHP Date difference between two dates

$dStart = new DateTime('2013-11-26');
 $dEnd  = new DateTime(date('Y-m-d'));
 $dDiff = $dStart->diff($dEnd);
//Date difference in days
  $date_diff_days    =     $dDiff->days;
             
    Another Method
        
$now = time();    
$your_date = strtotime('2013-11-26');
$datediff = $now - $your_date;
$date_diff_daysfloor($datediff/(60*60*24));