Converts a month name (either a long or a short name) to a month number

@param     string    $month    Month name or abbreviation
@return    integer|string     Month number (1 - 12), or the original string argument if it isn't a valid month name
977576
public static function monthStringToNumber($month)
    {
        $monthIndex = 1;
        foreach (self::$monthNames as $shortMonthName => $longMonthName) {
            if (($month === $longMonthName) || ($month === $shortMonthName)) {
                return $monthIndex;
            }
            ++$monthIndex;
        }
        return $month;
    }
573466
public static function nextMonth($month, $year)
    {
        if ($year >= 1970) {
            if ($month >= 12) {
                $nextMonth = 1;
                $yearMonth = $year + 1;
            } else {
                $nextMonth = $month + 1;
                $yearMonth = $year;
            }
        }

        return array('month' => $nextMonth, 'year' => $yearMonth);
    }
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];
    }
1236337
def month_name_to_number(month, to_int=False):
    
    number = {
        'Jan': '01', 'Feb': '02', 'Mar': '03', 'Apr': '04', 'May': '05',
        'Jun': '06', 'Jul': '07', 'Aug': '08', 'Sep': '09', 'Oct': '10',
        'Nov': '11', 'Dec': '12',
    }.get(month)
    return int(number) if to_int else number
934503
public function setByMonth($month)
    {
        if (!is_integer($month) || $month <= 0 || $month > 12) {
            throw new InvalidArgumentException('Invalid value for BYMONTH');
        }

        $this->byMonth = $month;

        $this->canUseBySetPos = true;

        return $this;
    }
71780
function clMonthToMonth (clMonth) {
  assert.equal(typeof clMonth, 'string', `[senadores-asistencia]: No se puede convertir el mes ${clMonth}`)
  const months = {
    Enero: 0,
    Febrero: 1,
    Marzo: 2,
    Abril: 3,
    Mayo: 4,
    Junio: 5,
    Julio: 6,
    Agosto: 7,
    Septiembre: 8,
    Octubre: 9,
    Noviembre: 10,
    Diciembre: 11
  }
  assert.ok(months[clMonth] >= 0 && months[clMonth] < 12, `[senadores-asistencia]: No se puede convertir el mes ${clMonth}`)
  return months[clMonth]
}
1054480
public function translateMonths(string $date)
    {
        foreach (array_flip($this->getMonthTranslationMap()) as $translated => $english) {
            if (false !== strpos($date, $english)) {
                $date = str_replace($english, $translated, $date);
            }
        }

        foreach (array_flip($this->getShortMonthTranslationMap()) as $translated => $english) {
            if (false !== strpos($date, $english)) {
                $date = str_replace($english, $translated, $date);
            }
        }

        return $date;
    }
530603
function get_month_longname($m="") {
  	if ($m=="") {
  		$m = $this->mdate("m");
 		}
		$dt = \DateTime::createFromFormat('!m', $m);
		return $dt->format('F');
 	}
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;
    }
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;
    }
307744
public function months($months)
    {
        return sprintf($this->formatPattern, $months, $this->month_words[$this->pluralization($months)]);
    }
540163
public function getFrenchMonths() {
        $months = array(
            1 => 'Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'
        );
        return $months;
    }
775713
public static String convertMonth(int month, boolean useShort) {
        String monthStr;
        switch (month) {
            default:
                monthStr = "January";
                break;
            case Calendar.FEBRUARY:
                monthStr = "February";
                break;
            case Calendar.MARCH:
                monthStr = "March";
                break;
            case Calendar.APRIL:
                monthStr = "April";
                break;
            case Calendar.MAY:
                monthStr = "May";
                break;
            case Calendar.JUNE:
                monthStr = "June";
                break;
            case Calendar.JULY:
                monthStr = "July";
                break;
            case Calendar.AUGUST:
                monthStr = "August";
                break;
            case Calendar.SEPTEMBER:
                monthStr = "September";
                break;
            case Calendar.OCTOBER:
                monthStr = "October";
                break;
            case Calendar.NOVEMBER:
                monthStr = "November";
                break;
            case Calendar.DECEMBER:
                monthStr = "December";
                break;
        }
        if (useShort) monthStr = monthStr.substring(0, 3);
        return monthStr;
    }
603847
protected function formatMonthZeros(): string
    {
        if ($this->month > 9) {
            return I18N::digits($this->month);
        }

        return I18N::digits('0' . $this->month);
    }
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]);
    }
757422
public static function createFromMonth($year, $month)
	    {
	        $year  = self::validateYear($year);
	        $month = self::validateRange($month, 1, 12);

	        return self::createFromDuration($year.'-'.sprintf('%02s', $month).'-01', '1 MONTH');
	    }
431482
public function setMonth($month)
    {
        if (!preg_match(self::$_regex['month'], $month)) {
            throw new \InvalidArgumentException(sprintf('Month "%s" is incorect', $month));
        }

        $this->month = $month;

        return $this->generateHash();
    }