Ich berechne die Tage zwischen 2 Datums so:
Das ganze funktioniert nicht richtig.
Beispiel 1: Di. 21.03.2012 - Sa. 24.03.2012 -> 4 Tage
Beispiel 2: So. 25.03.2012 - Mi. 28.03.2012 -> 3.95833333333 Tage
Woran zum Teufel liegt das?
Wie kann man die Tage besser berechnen?
PHP Code:
$myArrayDatumVon = explode(".", $von);
$datumVon = mktime(0,0,0,$myArrayDatumVon[1],$myArrayDatumVon[0],$myArrayDatumVon[2]);
$myArrayDatumBis = explode(".", $bis);
$datumBis = mktime(0,0,0,$myArrayDatumBis[1],$myArrayDatumBis[0],$myArrayDatumBis[2]);
$tage = (($datumBis-$datumVon) / (3600*24)) + 1;
Beispiel 1: Di. 21.03.2012 - Sa. 24.03.2012 -> 4 Tage
Beispiel 2: So. 25.03.2012 - Mi. 28.03.2012 -> 3.95833333333 Tage
Woran zum Teufel liegt das?
Wie kann man die Tage besser berechnen?
Comment