現在の週の最初と最後の日の日付を取得して表示するにはどうすればよいですか。
したがって、今週は次のように出力されます。
2012-05-14 - 2012-05-20
(今日は 2012 年 5 月 17 日です)
これはどのように簡単に行うことができますか?
現在の週の最初と最後の日の日付を取得して表示するにはどうすればよいですか。
したがって、今週は次のように出力されます。
2012-05-14 - 2012-05-20
(今日は 2012 年 5 月 17 日です)
これはどのように簡単に行うことができますか?
strtotimeを使用してみてください
$first = date('Y-m-d',strtotime("last monday"));
$last = date('Y-m-d',strtotime("next sunday"));
他の例
strtotime('monday this week');
strtotime('sunday this week');