php指定日の取得

724 ワード

/**
 php          ,   ,     
*/

$time = "2017-7-28";        //    

echo "       ". date("Y-m-d",strtotime("-1 days",$time))."";

echo "       ". date("Y-m-d",strtotime("-1 months",$time))."";

echo "       ". date("Y-m-d",strtotime("-1 years",$time))."";


//      ,   ,       

echo "       ". date("Y-m-d",strtotime("+1 days",$time))."";

echo "       ". date("Y-m-d",strtotime("+1 months",$time))."";

echo "       ". date("Y-m-d",strtotime("+1 years",$time))."";

//    1,  +1  -1  +n  -n    。