誰かが金曜日を選択すると、月曜日までの日数が自動的に追加されるようにします。$leavefrom
2014 年 3 月 1 日が木曜日で、 2014 年 3 月 2 日が金曜日であると想像してください$leaveto
。$totaldays
日付に基づいて計算されます。したがって、2日です。
<?php
$x = 0;
$date1 = str_replace('-', '/', $leavefrom);
$date2 = str_replace('-', '/', $leaveto);
while ($x < $totaldays) {
$tomorrow = date('l', strtotime($date1 ."+1 days"));
//$tomorrow = date("m-d-Y", strtotime( $date1 ."+1 days" ));
$getday = date('D', strtotime($tomorrow));
$x++;
if ($getday == "Sunday" || $getday = "Saturday") {
$tomorrow = date("m/d/Y", strtotime( $tomorrow ."+1 days" ));
}
$tomorrow = date("m/d/Y", strtotime( $tomorrow ."+1 days" ));
}
echo $tomorrow;
?>