public static function getMonthsRange($startData, $endDate) {
        $time1 = strtotime($startData); //absolute date comparison needs to be done here, because PHP doesn't do date comparisons
        $time2 = strtotime($endDate);
        //$my1 = date('mY', $time1); //need these to compare dates at 'month' granularity
        //$my2 = date('mY', $time2);
        $year1 = date('Y', $time1);
        $year2 = date('Y', $time2);
        $years = range($year1, $year2);
        $months = Array();
        foreach ($years as $year) {
            $months[$year] = array();
            while ($time1 < $time2) {
                if (date('Y', $time1) == $year) {
                    $months[$year][] = date('m', $time1);
                    $time1 = strtotime(date('Y-m-d', $time1) . ' +1 month');
                } else {
                    break;
                }
            }
            continue;
        }

        return $months;
    }
public static function getMonthsRange($startData, $endDate) {
        $time1 = strtotime($startData); //absolute date comparison needs to be done here, because PHP doesn't do date comparisons
        $time2 = strtotime($endDate);
        //$my1 = date('mY', $time1); //need these to compare dates at 'month' granularity
        //$my2 = date('mY', $time2);
        $year1 = date('Y', $time1);
        $year2 = date('Y', $time2);
        $years = range($year1, $year2);
        $months = Array();
        foreach ($years as $year) {
            $months[$year] = array();
            while ($time1 < $time2) {
                if (date('Y', $time1) == $year) {
                    $months[$year][] = date('m', $time1);
                    $time1 = strtotime(date('Y-m-d', $time1) . ' +1 month');
                } else {
                    break;
                }
            }
            continue;
        }

        return $months;
    }
public static function getMonthsRange ( $ startData , $ endDate ) { $ time1 = strtotime ( $ startData ) ; //absolute date comparison needs to be done here, because PHP doesn't do date comparisons $ time2 = strtotime ( $ endDate ) ; //$my1 = date('mY', $time1); //need these to compare dates at 'month' granularity //$my2 = date('mY', $time2); $ year1 = date ( 'Y' , $ time1 ) ; $ year2 = date ( 'Y' , $ time2 ) ; $ years = range ( $ year1 , $ year2 ) ; $ months = Array ( ) ; foreach ( $ years as $ year ) { $ months [ $ year ] = array ( ) ; while ( $ time1 < $ time2 ) { if ( date ( 'Y' , $ time1 ) == $ year ) { $ months [ $ year ] [ ] = date ( 'm' , $ time1 ) ; $ time1 = strtotime ( date ( 'Y-m-d' , $ time1 ) . ' +1 month' ) ; } else { break ; } } continue ; } return $ months ; }
Cria um intervalo de Meses de acordo com a data inicial e final
@param  date  $startData
@param  date  $endDate
@return array
Cria um intervalo de Meses de acordo com a data inicial e final