27 เมษายน 2554

ค้นหา วันเสาร์ - อาทิตย์ ภายในระยะเวลาที่ต้องการ

 <?php
$start = strtotime("2011-04-04 08:00:00"); // your start here
$end = strtotime("2011-04-29 08:50:00"); // +end dates here

$saturday = strtotime("saturday", $start);

while($saturday < $end) {
      
    echo "Saturday = ", date("d m Y", $saturday), "\n";
    echo '<br>';
  
    $sunday = strtotime("+1 days", $saturday);
      
        if($sunday < $end ){   //+ check if sunday more than $end
            echo "Sunday = ", date("d m Y", $sunday), "\n";
            echo '<br>'; 
        }
      
    $saturday = strtotime("+1 weeks", $saturday);
  
}
?>

ไม่มีความคิดเห็น:

แสดงความคิดเห็น