- date: documentation ( source)
- strtotime: documentation ( source)
<?php
echo date('Y-m-d 00:00:00', strtotime('first day of last month')). PHP_EOL;
echo date('Y-m-d 23:59:59', strtotime('last day of last month')) . PHP_EOL;
echo date('Y-m-d 00:00:00', strtotime('first day of this month')). PHP_EOL;
echo date('Y-m-d 23:59:59', strtotime('last day of this month')) . PHP_EOL;