Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function dty($sdate, $ldate) {
- $arr = array();
- $start = (new DateTime($sdate))->modify('first day of this month');
- $end = (new DateTime($ldate))->modify('first day of next month');
- $interval = DateInterval::createFromDateString('1 month');
- $period = new DatePeriod($start, $interval, $end);
- foreach ($period as $dt) {
- $arr[] = $dt->format("Y-M");
- // echo $dt->format("Y-M") . "<br>\n";
- }
- return $arr;
- }
- $tt = dty('2013-11', '2015-03');
- print_r($tt);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement