閲覧数:2294
投稿日:2018-08-08
更新日:2018-08-08
「今月の第3木曜日」の日を求める
・date("d", strtotime("third Thursday of this month"));
「今月の第2水曜日」の日を求める
・date("d", strtotime("second Wednesday of this month"));
コード
//「今月の第3木曜日」の日を求める
$d = date("d", strtotime("third Thursday of this month"));
echo $d; //16
$today = date('d');
if($today === $d){
echo "今日は「今月の第3木曜日」に該当します";
}
//「今月の第2水曜日」の日を求める
$d = date("d", strtotime("second Wednesday of this month"));
echo $d; //08
$today = date('d');
if($today === $d){
echo "今日は「今月の第2水曜日」に該当します";
}
結果
16 08 今日は「今月の第2水曜日」に該当します