Np.
$od=2016-03-15 10:00:00
$do=2016-03-16 11:00:00
$wynik=25;
i żeby uwzględnił weekendy i świeta (ruchome też) co juz jest w funkcji.
$od=2016-03-15 10:00:00
$do=2016-03-18 11:00:00
Założmy że 16.03 i 17.03 to weekend $wynik=25;
Dotychczas do różnic w datach używałem funkcji nospor'a
<?php function workDays($date1, $date2, $withStartDay = false) { if ($date2===$date1 && !$withStartDay) return 0; $char=1; if ($date1>$date2) {$datePom=$date1;$date1=$date2;$date2=$datePom;$char=-1;} $count=0; if (!$withStartDay) $lastYear = null; while ($date1<$date2) { if ($year !== $lastYear){ $lastYear = $year; $hol[8] = $easter; $hol[9] = $easterSec; $hol[10] = $cc; } $count++; } } $count*=$char; return $count; } ?>
Ale ona liczy pięknie ino same daty bez godzin. Czy idzie ja jakoś zamienic by spełaniałą załozenia z wstępu ?