Returns current quarter

@param integer $month Month number without leading zeros
@return integer
767879
public static function getQuarter($month = null)
    {
        if ($month === null) {
            $month = date('n', abs(time()));
        }

        if (in_array($month, range(1, 3))) {
            return 1;
        }

        if (in_array($month, range(4, 6))) {
            return 2;
        }

        if (in_array($month, range(7, 9))) {
            return 3;
        }

        if (in_array($month, range(10, 12))) {
            return 4;
        }
    }
1341541
function days_in_month($month = 0, $year = '') {
		if ($month < 1 || $month > 12) {
			$month = $this->mdate('m');
		}
		if (!is_numeric($year) || strlen($year) != 4) {
			$year = date('Y');
		}
		if ($month == 2) {
			if ($year % 400 == 0 || ($year % 4 == 0 && $year % 100 != 0)) {
				return 29;
			}
		}

		$days_in_month	= array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
		return $days_in_month[$month - 1];
	}
1058326
public static function lastDayOfMonth($month = null, $year = null, $format = 'Y-m-d')
    {
        $year = $year ? $year : date('Y');
        $month = $month ? $month : date('m');
        return date($format, mktime(0, 0, 0, $month + 1, 0, $year));
    }
1255502
public function withMonth(int $month) : ZonedDateTime
    {
        return ZonedDateTime::of($this->localDateTime->withMonth($month), $this->timeZone);
    }
1189204
public static function getDaysInMonth($month, $year)
    {
        if ($year == 1582 && $month == 10) {
            return 21;  // October 1582 only had 1st-4th and 15th-31st
        }

        if ($month == 2) {
            if (self::isLeapYear($year)) {
                return 29;
            } else {
                return 28;
            }
        } elseif ($month == 4 or $month == 6 or $month == 9 or $month == 11) {
            return 30;
        } else {
            return 31;
        }
    }
288936
private static function getMonths(): array
    {
        $months = [-1 => static::getConstant('TXT_DATETIME_MMM', 'TXT_DATETIME_MMM')];
        for ($i = 1; $i <= 12; $i++) {
            $months[$i] = static::getConstant('TXT_DATETIME_MONTH_'.$i.'_SHORT', 'TXT_DATETIME_MONTH_'.$i.'_SHORT');
        }
        return $months;
    }
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;
    }
197026
public static function previousMonth($ts = null, $month = sfTime::JANUARY)
	{
		// default to now
		if ($ts === null) $ts = sfDateTimeToolkit::now();
		
		// get offsets from january
		$offset1 = date('m', $ts);
		$offset2 = $month;
		
		// adjust if date wraps into last year
		$offset1 += $offset1 > $offset2 ? 0 : 12;
		
		return sfTime::subtractMonth($ts, $offset1 - $offset2);
	}
799534
public final function setMonth( int $month = null )
      : DateTime
   {

      if ( \is_null( $month ) )
      {
         $month = static::CurrentMonth();
      }

      return $this->setDateParts( null, $month );

   }
190857
public static function getAllMonthsByQuarter($quarter)
    {
        switch ($quarter) {
            case 1:
                return self::getMonthsByQuarter(1);
            case 2:
                return array_merge(self::getMonthsByQuarter(1), self::getMonthsByQuarter(2));
            case 3:
                return array_merge(self::getMonthsByQuarter(1), self::getMonthsByQuarter(2), self::getMonthsByQuarter(3));
            case 4:
                return array_merge(self::getMonthsByQuarter(1), self::getMonthsByQuarter(2), self::getMonthsByQuarter(3), self::getMonthsByQuarter(4));
            default:
                throw new LogicException(sprintf('Invalid quarter supplied - %s', $quarter));
        }
    }
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;
    }
96398
public Integer getMonth() {
		String dateValue = getValue();

		if (dateValue != null && dateValue.length() >= MONTH_END) {
			return parseDateComponent(dateValue.substring(MONTH_START, MONTH_END), getPaddingChar());
		} else {
			return null;
		}
	}
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;
        }
    }
848829
protected function daysYear($month, $day) {
        $days = 0;
        for ($i = 1; $i < $month; $i ++) {
            $days += static::$daysMonthJalali[$i];
        }
        return ($days + $day);
    }
902180
private static function getMonthSequence(array $months, $target, $withCurrent)
    {
        if (!in_array($target, $months)) {
            throw new LogicException(
                sprintf('Target month "%s" is out of range. The range must be from 01 up to 12', $target)
            );
        }

        $collection = array();

        foreach ($months as $month) {
            if ($month == $target) {
                if ($withCurrent === true) {
                    $collection[] = $month;
                }
                break;
            } else {
                $collection[] = $month;
            }
        }

        return $collection;
    }
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;
    }
977576
public static function monthStringToNumber($month)
    {
        $monthIndex = 1;
        foreach (self::$monthNames as $shortMonthName => $longMonthName) {
            if (($month === $longMonthName) || ($month === $shortMonthName)) {
                return $monthIndex;
            }
            ++$monthIndex;
        }
        return $month;
    }