src/Transformatika/Utility/Fn.php
public static function weekRangeInMonth($month, $year)
    {
        $year  = (int)$year;
        $month = (int)$month;
        if ($year < 1970) { // minimal unix time year 1970
            $month = date("n");
            $year  = date("Y");
        }
        if ($month <= 0 || $month > 12) {
            $month = date("n");
            $year  = date("Y");
        }
        if ($month < 10) {
            $month2 = '0' . $month;
        } else {
            $month2 = $month;
        }
        $weekAwal  = (int)$this->weekNumber($year . '-' . $month2 . '-01');
        $weekAkhir = (int)$this->weekNumber($year . '-' . $month2 . '-' . $this->maxDateInMonth($month, $year));
        /*
          echo $year.'-'.$month2.'-01';
          echo '<br />';
          echo $weekAwal;
          echo '<br />';
          echo $year.'-'.$month2.'-'.$this->getMaxDateInMonth($month,$year);
          echo '<br />';
          echo $weekAkhir;
         */
        if ($weekAwal > $weekAkhir) {
            $weekAwal = 1;
        }
        $a = 0;

        for ($i = $weekAwal; $i <= $weekAkhir; $i++) {
            $a++;
            $weekRange[$a] = (int)$i;
        }

        return $weekRange;
    }
public static function weekRangeInMonth($month, $year)
    {
        $year  = (int)$year;
        $month = (int)$month;
        if ($year < 1970) { // minimal unix time year 1970
            $month = date("n");
            $year  = date("Y");
        }
        if ($month <= 0 || $month > 12) {
            $month = date("n");
            $year  = date("Y");
        }
        if ($month < 10) {
            $month2 = '0' . $month;
        } else {
            $month2 = $month;
        }
        $weekAwal  = (int)$this->weekNumber($year . '-' . $month2 . '-01');
        $weekAkhir = (int)$this->weekNumber($year . '-' . $month2 . '-' . $this->maxDateInMonth($month, $year));
        /*
          echo $year.'-'.$month2.'-01';
          echo '<br />';
          echo $weekAwal;
          echo '<br />';
          echo $year.'-'.$month2.'-'.$this->getMaxDateInMonth($month,$year);
          echo '<br />';
          echo $weekAkhir;
         */
        if ($weekAwal > $weekAkhir) {
            $weekAwal = 1;
        }
        $a = 0;

        for ($i = $weekAwal; $i <= $weekAkhir; $i++) {
            $a++;
            $weekRange[$a] = (int)$i;
        }

        return $weekRange;
    }
public static function weekRangeInMonth ( $ month , $ year ) { $ year = ( int ) $ year ; $ month = ( int ) $ month ; if ( $ year < 1970 ) { // minimal unix time year 1970
 $ month = date ( "n" ) ; $ year = date ( "Y" ) ; } if ( $ month <= 0 || $ month > 12 ) { $ month = date ( "n" ) ; $ year = date ( "Y" ) ; } if ( $ month < 10 ) { $ month2 = '0' . $ month ; } else { $ month2 = $ month ; } $ weekAwal = ( int ) $ this -> weekNumber ( $ year . '-' . $ month2 . '-01' ) ; $ weekAkhir = ( int ) $ this -> weekNumber ( $ year . '-' . $ month2 . '-' . $ this -> maxDateInMonth ( $ month , $ year ) ) ; /*
          echo $year.'-'.$month2.'-01';
          echo '<br />';
          echo $weekAwal;
          echo '<br />';
          echo $year.'-'.$month2.'-'.$this->getMaxDateInMonth($month,$year);
          echo '<br />';
          echo $weekAkhir;
         */ if ( $ weekAwal > $ weekAkhir ) { $ weekAwal = 1 ; } $ a = 0 ; for ( $ i = $ weekAwal ; $ i <= $ weekAkhir ; $ i ++ ) { $ a ++ ; $ weekRange [ $ a ] = ( int ) $ i ; } return $ weekRange ; }
Week Range In Month
@param  Date - Month
@param  Date - Year
@return Array
Week Range In Month