PHPでカレンダーを作ろうとしています。月の初日の平日 (日曜日、月曜日など) を取得する必要があります。これまでの私のコードは次のとおりです。
<?php
$current_month = date("n");
$current_year = date("Y");
$first_day_of_month = new DateTime();
$first_day_of_month -> setDate($current_year,$current_month,1);
?>
設定された日付の平日(月の最初)を取得する方法に行き詰まっています。助言がありますか?