<?php // 本日の日付 echo date("Y/m/d"); // 今月末日 echo date("Y/m/t"); // 1日前 echo date("Y/m/d",strtotime("-1 day")); // 1週間前 echo date("Y/m/d",strtotime("-1 week")); // 1ヶ月前 echo date("Y/m/d",strtotime("-1 month")); // 来月末日 echo date("Y/m/t",strtotime("1 month")); // 1年前 echo date("Y/m/d",strtotime("-1 year")); // 1日後 echo date("Y/m/d",strtotime("+1 day")); // 3日前 echo date("Y/m/d",strtotime("-3 day")); // 次の日曜日 echo date("Y/m/d",strtotime("next Sunday")); // 次の次の日曜日 echo date("Y/m/d",strtotime("+2 Sunday")); // この前の日曜日 echo date("Y/m/d",strtotime("last Sunday")); // 先週の日曜日 echo date("Y/m/d",strtotime("2 weeks ago Sunday")); // 先週の土曜日 echo date("Y/m/d",strtotime("last Saturday")); //来月1日 echo date("Y/m/d",strtotime("first day of next month"));
※「この前の日曜日」と「先週の日曜日」は違うので注意