MonthsFromDuration
@param object $arg
@return Integer
162527
public static function MonthsFromDuration( $arg )
	{
		if ( $arg instanceof Undefined )
		    return Undefined::getValue();

	    /**
	     * @var DurationValue $duration
	     */
	    $duration = $arg;

	    return Integer::FromValue( $duration->getMonths() * ( $duration->getInverted() ? -1 : 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];
        }
    }
1347182
public function getMonths($year)
    {
        $year = $this->yearOrYearNo($year);

        $months = array();

        for ($monthNo = 1; $monthNo <= 12; $monthNo++) {
            $months[$monthNo] = new Month($year, $monthNo);
        }

        return $months;
    }
1037047
public function monthToString($month, $abbr = false)
	{
		switch ($month)
		{
			case 1:
				return $abbr ? \Lang::txt('JANUARY_SHORT') : \Lang::txt('JANUARY');
			case 2:
				return $abbr ? \Lang::txt('FEBRUARY_SHORT') : \Lang::txt('FEBRUARY');
			case 3:
				return $abbr ? \Lang::txt('MARCH_SHORT') : \Lang::txt('MARCH');
			case 4:
				return $abbr ? \Lang::txt('APRIL_SHORT') : \Lang::txt('APRIL');
			case 5:
				return $abbr ? \Lang::txt('MAY_SHORT') : \Lang::txt('MAY');
			case 6:
				return $abbr ? \Lang::txt('JUNE_SHORT') : \Lang::txt('JUNE');
			case 7:
				return $abbr ? \Lang::txt('JULY_SHORT') : \Lang::txt('JULY');
			case 8:
				return $abbr ? \Lang::txt('AUGUST_SHORT') : \Lang::txt('AUGUST');
			case 9:
				return $abbr ? \Lang::txt('SEPTEMBER_SHORT') : \Lang::txt('SEPTEMBER');
			case 10:
				return $abbr ? \Lang::txt('OCTOBER_SHORT') : \Lang::txt('OCTOBER');
			case 11:
				return $abbr ? \Lang::txt('NOVEMBER_SHORT') : \Lang::txt('NOVEMBER');
			case 12:
				return $abbr ? \Lang::txt('DECEMBER_SHORT') : \Lang::txt('DECEMBER');
		}
	}
222096
public function getMonthNamesNarrow($month = null)
    {
        $calendar = $this->getName();
        // gregorian, generic

        $data = array();
        $calendsFallback = array($calendar, 'gregorian', 'generic');
        foreach ($calendsFallback as $calendar) {
            $data = $this->getRepoReader()->getEntityByPath(
                'dates/calendars/calendar[@type="'.$calendar.'"]/months/monthContext[@type="format"]/monthWidth[@type="abbreviated"]/month'
            );

            if ($data) {
                break;
            }
        }

        $months = array();
        foreach($data as $d) {
            $months[$d['type']] = $d['value'];
        }

        $return = ($month == null) ? $months : false;

        return isset($months[$month]) ? $months[$month] : $return;
    }
367904
public function getMonths() {
        $months = array();
        for ($i = 1; $i <= 12; $i++) {
            if ($i < 10)
                $months[$i] = '0' . $i;
            else
                $months[$i] = $i;
        }
        return $months;
    }
380450
public static function getMonthAbbrname($month, $length = 3)
    {
        $month = (int) $month;
        return substr(self::getMonthFullname($month), 0, $length);
    }
870025
public function monthname($timestamp = 0)
    {
        // get month from timestamp
        $month = (int) date('n', $timestamp) - 1;

        // return translated (localized) month-name
        return $this->translator->_($this->month[$month]);
    }
1173081
public static function MinutesFromDuration( $arg )
	{
		if ( $arg instanceof Undefined )
		{
			return Undefined::getValue();
		}

		/**
		 * @var DurationValue $duration
		 */
		$duration = $arg;

		return Integer::FromValue( $duration->getMinutes() * ( $duration->getInverted() ? -1 : 1 ) );
	}
961605
public static function HoursFromTime( $arg )
	{
		if ( $arg instanceof Undefined )
		{
			return Undefined::getValue();
		}

		if ( ! $arg instanceof TimeValue )
		{
			return Undefined::getValue();
		}

		/**
		 * @var TimeValue $time
		 */
		$time = $arg;
		return $time->Value->format( "H" ) + 0;
	}
1034880
private function monthlySummary($metrics = 'ga:users', $month = 'month')
    {
        if ($month == '-month_1') {
            $end = Carbon::now()->subMonth()->endOfMonth();
            $start = Carbon::now()->subMonth()->startOfMonth();
        }
        else {
            $end = Carbon::now();
            $start = Carbon::now()->startOfMonth();
        }

        $data = LaravelAnalytics::performQuery($start->startOfDay(), $end->endOfDay(), $metrics);

        if ($data->rows && count($data->rows) >= 1 && count($data->rows[0]) >= 1) {
            return $data->rows[0][0];
        }

        return 0;
    }
197679
public function setToFirstDayOfMonth(int $month = null) : Time
    {
        if ($this->frozen) {
            throw new \RuntimeException(get_class($this) . ' is read-only, frozen.');
        }
        if ($month !== null) {
            if ($month < 1 || $month > 12) {
                throw new \InvalidArgumentException('Arg month[' . $month . '] isn\'t null or 1 through 12.');
            }
            $mnth = $month;
        }
        else {
            $mnth = (int) $this->format('m');
        }
        return $this->setDate(
            (int) $this->format('Y'),
            $mnth,
            1
        );
    }
223572
static function prevMonth($key = null) {
        $prev = self::todayIfNull(date('Y') . '-' . date('M') . '-01') - 24 * 3600;
        $ret  = [
            'y' => (int)date('Y', $prev),
            'm' => (int)date('m', $prev),
        ];
        return $key ? Arr::get($ret, $key) : $ret;
    }
824683
public function eachMonths($months = 1, \Closure $callback, $onlyFullMonth = false)
    {
        if ($this->lengthInMonths() > 0) {
            return $this->each(
                new \DateInterval("P{$months}M"),
                function (CarbonPeriod $period) use ($months, $callback, $onlyFullMonth) {
                    if (!$onlyFullMonth || $period->lengthInMonths() === $months) {
                        call_user_func_array($callback, func_get_args());
                    }
                }
            );
        }

        return $this;
    }
78318
protected function getMonths()
    {
        $intSecondsPerMonth = ($this->isPositive()) ? DateTimeSpan::SECONDS_PER_MONTH : ((-1) * DateTimeSpan::SECONDS_PER_MONTH);
        $intMonths = floor($this->intSeconds / $intSecondsPerMonth);
        if ($this->isNegative()) {
            $intMonths = (-1) * $intMonths;
        }
        return $intMonths;
    }
74293
public static function getMonthNames()
    {
        static $months;
        if (!isset($months)) {
            $months = array();
            for ($i = 1; $i < 13; $i++) {
                $months[$i] = strftime('%B', mktime(0, 0, 0, $i, 1, 2001));
            }
        }
        return $months;
    }
1219801
public static function getMonthEnd($month = -1, $year = -1)
    {
        if ($month == -1) {
            $month = date("n");
        }
        if ($year == -1) {
            $year = date("Y");
        }

        //gets the number of days in the actual month
        $tempTime = mktime(0, 0, 0, $month, 1, $year);
        $tempTime = date("t", $tempTime);

        return mktime(23, 59, 59, $month, $tempTime, $year);
    }