mam problem z analizą czasu:
-pobieram aktualny czas: date('Y-m-d H:i:s') i chciałbym spr. czy jest on w przedziale od piątku 23.00 do niedzieli 23.00. Jak to zrobić?
Z góry bardzo dziękuję za pomoc!
$dt = new \DateTime('2000-12-31 22:34:11'); $dt->modify("+1 hour"); if($dt->format("N") === 6 || $dt->format("N") === 7) { }
<?php if(!function_exists('CompareDates')) { function CompareDates($dateObj1, $dateObj2, $timeObj, $tabObj){ date_default_timezone_set("Europe/Warsaw"); if( ( $dateObj1 == $tabObj[0] && $dateObj2 >= $timeObj ) || ( $dateObj1 == $tabObj[1] ) || ( $dateObj1 == $tabObj[2] && $dateObj2 < $timeObj ) ) { }else { }; }; }; ?>
<?php date_default_timezone_set("Europe/Warsaw"); $startDate="5/23"; // 5 to dzien tygodnia czeli piatek; 23 to godzina $endDate="7/22"; // 7 to niedziela a 22 godzina i bedzie dostepne do 22:59 }else{ } ?>