<?
$time=strtotime('2020-04-21'); // get unixtime of custom date
$day=date('d', $time); // get day of custom date
$year=date('Y', $time); // get year of custom date
$month=date('m'); // get current month
$time_first=mktime(0, 0, 0, $month, $day, $year); // get unixtime for first
$time_second=strtotime('-1 month', $time_first); // get unixtime previous month
$date_first=date('Y-m-d', $time_first); // string format of first date
$date_second=date('Y-m-d', $time_second); // string format of second date
var_dump($date_first);
var_dump($date_second);
?>