我想获得上个月的第一个日期和最后一个日期.
$first_date = strtotime('first day of previous month', time());
$previous_month_first_date=date('Y-m-d', $first_date);
$previous_month_last_date=date('Y-m-d', strtotime('last day of previous month'));
Run Code Online (Sandbox Code Playgroud)
=>试试这段代码我希望它有用..
echo date('Y-m-d', strtotime('first day of last month'));
echo "<br/>";
echo date('Y-m-d', strtotime('last day of last month'));
Run Code Online (Sandbox Code Playgroud)
输出: - https://eval.in/925253