2010
07.30

Simple and easy solution for counting difference between two dates in days for PHP 4+. Input in common DB form ‘YYYY-MM-DD’

function DateDiff($date1,$date2) 
{
 $date1 = strtotime(substr($date1,0,10)." 23:59:59");
 $date2 = strtotime(substr($date2,0,10)." 23:59:59");
 
 $daysDiff = ($date2 – $date1)/(24 * 60 * 60);
 
 return abs(round($daysDiff));   
}

Comments are closed.

ENVATO FLASH STOCK ENVATO THEME FOREST

CBDB.cz - moje knihy