指定时间的前一个月
输入2021-02-03 返回 2021-01-01|2021-01-31
// PHP获取指定时间的前一个月的时间范围
$start_date = '2021-02-03';
$timestamp = strtotime('-1 month', strtotime($start_date));
$start_date = date('Y-m-01', $timestamp);
$end_date = date('Y-m-' . date('t', $timestamp), $timestamp);
print_r($start_date.'|'.$end_date);
// 2021-01-01|2021-01-31