2017-08-13 3 views
0

今週現在毎週出力しようとしている。私は以下のコードを使用していますが、月曜日から日曜日までは使用できません。strtotimeを使用してMon-Sunを使用していないすべての週を出力するが、Sun-Sat PHPの場合

for ($i = 0; $i < date("W"); $i++) 
{ 
echo '<option value="' . date("W", strtotime("this monday - $i week")) . '">' . date("M j Y", strtotime("this sunday - $i week")) . " - " . date("M j Y", strtotime("this saturday - $i week")) .'</option>'; 
} 
+0

あなたは月曜日〜Sunday'を使用しているときに、 'それが動作しないことにより、どのような意味ですか定義してくださいことはできますか? – Fotis

答えて

0

私はすべてこのことを謝罪しています。私はこれを減算するのではなく、追加する必要があることを認識しました。私として出力与える:

「2017年8月14日を - 2017年8月20日」

'<option value="' . date("W", strtotime("this monday - $i week")) . '">' . date("M j Y", strtotime("this monday - $i week")) . " - " . date("M j Y", strtotime("next sunday + $i week")) .'</option>' 
関連する問題