最初我试图创建一个函数来显示特定日期有多少次进入特定日期。例如星期六有多少次落在某年的 1 月 1 日到某年。
<?php
$firstDate = '01/01/2000';
$endDate = '01/01/2012';
$newYearDate= '01/01';
# convert above string to time
$time1 = strtotime($firstDate);
$time2 = strtotime($endDate);
$newYearTime = strtotime($newYearDate);
for($i=$time1; $i<=$time2; $i++){
$saturday = 0;
$chk = date('D', $newYearTime); #date conversion
if($chk == 'Sat' && $chk == $newYearTime){
$saturday++;
}
}
echo $saturday;
?>