echo date('M Y', strtotime("-1 month")); //to get date with time of previous month echo date("Y-m-d H:i:s",strtotime("-1 month"));