- time: documentation ( source)
- date: documentation ( source)
- strtotime: documentation ( source)
<?php
$period = '5';
$previousMonth = strtotime(date("Y-m-d", time()) . ' -' . (int)$period . ' day');
$desde = date("Y-m-d", $previousMonth);
$hasta = date("Y-m-d", time());
echo $desde . "\n";
echo $hasta;