Berechnen Sie die Differenz zwischen zwei Datumsangaben in Tagen ist sehr, sehr einfach mit PHP.
Hier ist die Funktion, dass die Berechnung zurückgibt:
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;
} Werte an die Funktion übergeben werden sollen, wie folgt:
-
GiornoA $, $ monat, $ jahr: Tag, Monat und Jahr (int) date weniger
-
$ GiornoB, meseB $, $ annoB: Tag, Monat und Jahr (int) Datum mehr