Returns a copy of this YearMonth with the month-of-year altered.

@param int $month

@return YearMonth

@throws DateTimeException If the month-of-year is not valid.
184560
public function withMonth(int $month) : YearMonth
    {
        if ($month === $this->month) {
            return $this;
        }

        Field\MonthOfYear::check($month);

        return new YearMonth($this->year, $month);
    }
919677
public static function gregorianToJd($month, $day, $year)
    {
        if ($year == 0) {
            return 0;
        } else {
            return self::$gregorian_calendar->ymdToJd($year, $month, $day);
        }
    }
1303817
protected function getMonth()
    {
        $arrMonth = array();
        $objMonth = \Database::getInstance()->prepare("SELECT
                                                         FROM_UNIXTIME(`tstamp`,'%Y-%m')  AS YM
                                                       , COUNT(`id`) AS SUMDL
                                                       FROM `tl_dlstatdets`
                                                       WHERE 1
                                                       GROUP BY YM
                                                       ORDER BY YM DESC")
                                            ->limit(12)
                                            ->execute();
        $intRows = $objMonth->numRows;
        if ($intRows>0)
        {
            while ($objMonth->next())
            {
                $Y = substr($objMonth->YM, 0,4);
                $M = (int)substr($objMonth->YM, -2);
                $arrMonth[] = array($Y.' '.$GLOBALS['TL_LANG']['MONTHS'][($M - 1)], $this->getFormattedNumber($objMonth->SUMDL,0) );
            }
        }

        return $arrMonth;
    }
1051627
public function getMonthName($month = null)
    {
        if ($month === null) {
            $month = $this->getMonth();
        }
        if ($month <= 0) {
            $month += count($this->monthNames);
        }

        $idx = $month - 1;

        return $this->monthNames[$idx];
    }
323367
public static function from(DateTimeParseResult $result) : YearMonth
    {
        return YearMonth::of(
            (int) $result->getField(Field\Year::NAME),
            (int) $result->getField(Field\MonthOfYear::NAME)
        );
    }
1368379
public function getAge($day, $month, $year) {
        $years = date('Y') - $year;
        if (date('m') < $month)
            $years--;
        elseif (date('d') < $day && date('m') == $month)
            $years--;

        return $years;
    }
56838
public static function extensionShortMonth($month) {
        $mes = null;
        switch ($month) {
            case '01':
            case 1:
                $mes = "Jan";
                break;
            case '02':
            case 2:
                $mes = "Fev";
                break;
            case '03':
            case 3:
                $mes = "Mar";
                break;
            case '04':
            case 4:
                $mes = "Abr";
                break;
            case '05':
            case 5:
                $mes = "Mai";
                break;
            case '06':
            case 6:
                $mes = "Jun";
                break;
            case '07':
            case 7:
                $mes = "Jul";
                break;
            case '08':
            case 8:
                $mes = "Ago";
                break;
            case '09':
            case 9:
                $mes = "Set";
                break;
            case '10':
            case 10:
                $mes = "Out";
                break;
            case '11':
            case 11:
                $mes = "Nov";
                break;
            case '12':
            case 12:
                $mes = "Dez";
                break;
        }

        return $mes;
    }
1278574
public function subtractMonths($months)
    {
        $months = (int) $months;
        $months = -$months;
        return $this->addMonths($months);
    }
897903
public function setDate($year, $month, $day)
    {
        return parent::setDate(self::$yearMustAlwaysBe, self::$monthMustAlwaysBe, self::$dayMustAlwaysBe);
    }
1147796
public function ymdToJd($year, $month, $day)
    {
        return
            $this->yToJd($year) +
            self::$CUMULATIVE_DAYS[$this->isLeapYear($year)][$this->yearType($year)][$month] +
            $day - 1;
    }
1205216
public function daysInMonth($year, $month)
    {
        if ($year < 1) {
            throw new InvalidArgumentException('Year ' . $year . ' is invalid for this calendar');
        } elseif ($month < 1 || $month > 13) {
            throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
        } elseif ($month == 2) {
            return $this->daysInMonthHeshvan($year);
        } elseif ($month == 3) {
            return $this->daysInMonthKislev($year);
        } elseif ($month == 6) {
            return $this->daysInMonthAdarI($year);
        } else {
            return self::$FIXED_MONTH_LENGTHS[$month];
        }
    }
1088678
public function daysInMonth($year, $month)
    {
        if ($year === 0) {
            throw new InvalidArgumentException('Year ' . $year . ' is invalid for this calendar');
        } elseif ($month < 1 || $month > 12) {
            throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
        } elseif ($month === 1 || $month === 3 || $month === 5 || $month === 7 || $month === 8 || $month === 10 || $month === 12) {
            return 31;
        } elseif ($month === 4 || $month === 6 || $month === 9 || $month === 11) {
            return 30;
        } elseif ($this->isLeapYear($year)) {
            return 29;
        } else {
            return 28;
        }
    }
1324581
public function getOffsetMonth($offsetNumMonths) {
        return new self(
            mktime(
                0,
                0,
                0,
                date('n', $this->getEpoch()) + $offsetNumMonths,
                date('j', $this->getEpoch()),
                date('Y', $this->getEpoch())
            )
        );
    }
1195173
public function daysInMonth($year, $month)
    {
        if ($year <= 0) {
            throw new InvalidArgumentException('Year ' . $year . ' is invalid for this calendar');
        } elseif ($month < 1 || $month > 13) {
            throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
        } elseif ($month !== 13) {
            return 30;
        } elseif ($this->isLeapYear($year)) {
            return 6;
        } else {
            return 5;
        }
    }
403048
protected function getMonthOptionText($month)
    {
        $text = '';

        if ($this->show_month_number) {
            $text .= str_pad($month, 2, '0', STR_PAD_LEFT) . ' - ';
        }

        $date = new SwatDate('2010-' . $month . '-01');

        $text .= $date->formatLikeIntl('MMMM');

        return $text;
    }
1234703
public static function getMonthFullname($month)
    {
        $month = (int) $month;
        $names = self::getMonthNames();
        return $names[$month];
    }
1218319
public function ymdToJd($year, $month, $day)
    {
        if ($month < 1 || $month > $this->monthsInYear()) {
            throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
        }

        $epbase = $year - (($year >= 0) ? 474 : 473);
        $epyear = 474 + $this->mod($epbase, 2820);

        return
            $day +
            (($month <= 7) ? (($month - 1) * 31) : ((($month - 1) * 30) + 6)) +
            (int) ((($epyear * 682) - 110) / 2816) +
            ($epyear - 1) * 365 +
            (int) (floor($epbase / 2820)) * 1029983 +
            $this->jdStart() - 1;
    }