echo date('Y-m-01', strtotime('-1 month')); echo "<br/>"; echo date('Y-m-t', strtotime('-1 month')); echo "<br/>";