Calculate the difference between two dates in terms of days is very, very simple with PHP. Here is the function that returns the calculation:
function days_diff( $giornoA, $meseA, $annoA, $giornoB, $meseB, $annoB )
{
$timestampA = mktime(0, 0, 0, $meseA, $giornoA, $annoA);
$timestampB = mktime(0, 0, 0, $meseB, $giornoB, $annoB);
$diff = floor(($timestampB - $timestampA) / (3600 * 24));
return $diff;
} function days_diff( $giornoA, $meseA, $annoA, $giornoB, $meseB, $annoB )
{
$timestampA = mktime(0, 0, 0, $meseA, $giornoA, $annoA);
$timestampB = mktime(0, 0, 0, $meseB, $giornoB, $annoB);
$diff = floor(($timestampB - $timestampA) / (3600 * 24));
return $diff;
} Values to be passed to the function are:
- $ giornoA, $ month, $ year: day, month and year (int) date child
- $ giornoB, $ meseB, $ annoB: day, month and year (int) date more