<?php function getLastMonth(DateTime $date) { //avoid side affects $date = clone $date; $date->modify('first day of last month'); return array( $date->format('Y-m-d'), $date->format('Y-m-t'), ); } list($start, $end) = getLastMonth(new \DateTime()); var_dump($start, $end);
You have javascript disabled. You will not be able to edit any code.