PHP 日付処理のメモ strtotime()

n日後、n日前の日付を求める

strtotime()を使うと簡単。

<?php
//2年前
$timestamp = strtotime("-2 years");
$date      = date("Y-m-d", $timestamp);

echo $date;
?>

その他の表現

<?php
strtotime("now");
strtotime("10 September 2000");
strtotime("+1 day");
strtotime("+1 week");
strtotime("+1 month");
strtotime("+1 week 2 days 4 hours 2 seconds");
strtotime("next Thursday");
strtotime("last Monday");
?>

参考↓
http://php.net/manual/ja/function.strtotime.php