Returns a month name.

Shim implementation of JDMonthName()

@link https://php.net/JDMonthName

@param int $julian_day
@param int $mode

@return string
541767
public static function jdMonthName($julian_day, $mode)
    {
        switch ($mode) {
            case CAL_MONTH_GREGORIAN_LONG:
                return self::jdMonthNameCalendar(self::$gregorian_calendar, $julian_day, self::$MONTH_NAMES);

            case CAL_MONTH_JULIAN_LONG:
                return self::jdMonthNameCalendar(self::$julian_calendar, $julian_day, self::$MONTH_NAMES);

            case CAL_MONTH_JULIAN_SHORT:
                return self::jdMonthNameCalendar(self::$julian_calendar, $julian_day, self::$MONTH_NAMES_SHORT);

            case CAL_MONTH_JEWISH:
                return self::jdMonthNameCalendar(self::$jewish_calendar, $julian_day, self::jdMonthNameJewishMonths($julian_day));

            case CAL_MONTH_FRENCH:
                return self::jdMonthNameCalendar(self::$french_calendar, $julian_day, self::$MONTH_NAMES_FRENCH);

            case CAL_MONTH_GREGORIAN_SHORT:
            default:
                return self::jdMonthNameCalendar(self::$gregorian_calendar, $julian_day, self::$MONTH_NAMES_SHORT);
        }
    }
1109594
function lastday ($month,$day,$year)

	{

		$lastdayen=date("d",mktime(0,0,0,$month+1,0,$year));

		list( $jyear, $jmonth, $jday ) = $this->gregorian_to_jalali($year, $month, $day);

		$lastdatep=$jday;

		$jday=$jday2;

		while($jday2!="1")

		{

			if($day<$lastdayen)

			{

				$day++;

				list( $jyear, $jmonth, $jday2 ) = $this->gregorian_to_jalali($year, $month, $day);

				if($pdate2=="1") break;

				if($pdate2!="1") $lastdatep++;

			}

			else

			{

				$day=0;

				$month++;

				if($month==13)

				{

					$month="1";

					$year++;

				}

			}



		}

		return $lastdatep-1;

	}
514918
public function ymdToJd($year, $month, $day)
    {
        if ($month < 1 || $month > $this->monthsInYear()) {
            throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
        }

        return $day + 29 * ($month - 1) + (int) ((6 * $month - 1) / 11) + $year * 354 + (int) ((3 + 11 * $year) / 30) + 1948085;
    }
783986
public static function monthName($month, $abbr = false, array $options = []) {
		$months = [
			'long' => [
				'January',
				'February',
				'March',
				'April',
				'May',
				'June',
				'July',
				'August',
				'September',
				'October',
				'November',
				'December'
			],
			'short' => [
				'Jan',
				'Feb',
				'Mar',
				'Apr',
				'May',
				'Jun',
				'Jul',
				'Aug',
				'Sep',
				'Oct',
				'Nov',
				'Dec'
			],
		];
		$month = (int)($month - 1);
		if (!$abbr) {
			return __d('tools', $months['long'][$month]);
		}
		$monthName = __d('tools', $months['short'][$month]);
		if (!empty($options['appendDot']) && strlen(__d('tools', $months['long'][$month])) > 3) {
			$monthName .= '.';
		}
		return $monthName;
	}
999156
public function getSeasonMonthName($season = null, $month = null)
    {
        if ($season === null) {
            $season = $this->getSeason();
        }
        if ($month === null) {
            $month = $this->getMonth();
        }
        if ($month <= 0) {
            $month += count($this->monthNames);
        }
        $idx = ($season - 1) * 3 + ($month - 1);

        return $this->monthNames[$idx];
    }
593077
protected function jdToY($julian_day)
    {
        // Estimate the year, and underestimate it, it will be refined after
        $year = max((int) ((($julian_day - 347998) * 98496) / 35975351) - 1, 1);

        // Adjust by adding years;
        while ($julian_day >= $this->yToJd($year + 1)) {
            $year++;
        }

        return $year;
    }
1274655
public static int getMonthDay(Calendar cal) {
		int month = cal.get(Calendar.MONTH) + 1;
		int day = cal.get(Calendar.DAY_OF_MONTH);
		int monthDay = month * MONTH_MULTIPLICATOR + day;

		return monthDay;
	}
176212
private static synchronized BaseCalendar getJulianCalendarSystem() {
        if (jcal == null) {
            jcal = (JulianCalendar) CalendarSystem.forName("julian");
            jeras = jcal.getEras();
        }
        return jcal;
    }
376952
private static function getMonthNames($month, $shorten = false, $len = 3)
    {
        // Convert
        $months = ['فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند'];
        $ret = $months[ $month - 1 ];

        // Return
        return ($shorten) ? self::substr($ret, 0, $len) : $ret;
    }
96127
private static String toBootstrapDateFormat(final String format) {
        String bootstrap_format = format;

        // Replace long day name "EEEE" with "DD"
        bootstrap_format = bootstrap_format.replace("EEEE", "DD");
        // Replace short day name "EE" with "DD"
        bootstrap_format = bootstrap_format.replaceAll("E{1,3}", "D");
        // If there are at least 3 Ms there is month name in wording
        if (bootstrap_format.contains("MMM")) {
            // Replace long date month "MMMM" with "MM"
            bootstrap_format = bootstrap_format.replace("MMMM", "MM");
            // Replace month name "MMM" with "M"
            bootstrap_format = bootstrap_format.replace("MMM", "M");
        }
        else {
            // Replace month number with leading 0 "MM" with "mm"
            bootstrap_format = bootstrap_format.replace("MM", "mm");
            // Replace month number "M" with "m"
            bootstrap_format = bootstrap_format.replace("M", "m");
        }
        if (!bootstrap_format.contains("yy")) {
            // Replace full year format "y" with "yyyy"
            bootstrap_format = bootstrap_format.replace("y", "yyyy");
        }

        return bootstrap_format;
    }
830878
public static function getEndDate($month = null, $day = null)
    {
        if ($month == null && $day == null) {
            // tomorrow
            $date = new \DateTime(Utils::getNextDay(date('m'), date('d')));
        } else 
            if ($day == null) {
                // first day of next mnth
                $date = new \DateTime(Utils::getNextMonthFirstDay($month, $day));
            } else {
                // date +1 day
                $date = new \DateTime(Utils::getNextDay($month, $day));
            }
        return $date->format('Y-m-d');
    }
884221
public static function julianToJd($month, $day, $year)
    {
        if ($year == 0) {
            return 0;
        } else {
            return self::$julian_calendar->ymdToJd($year, $month, $day);
        }
    }
1073576
protected static function julian2jalali($julianDayNumber) {
        
        $gYear  = self::julian2georgian($julianDayNumber)[0];
        $year   = $gYear - static::HEGIRA_STARTING_YEAR;
        $parsed = self::parseJalali($year);
        $jdn1f  = self::georgian2julian($gYear, 3, $parsed['march']);
        
        // Find number of days that passed since 1 Farvardin.
        $passed = $julianDayNumber - $jdn1f;
        
        if ($passed >= 0) {
            if ($passed <= 185) {
                $month = 1 + self::division($passed, 31);
                $day   = ($passed % 31) + 1;
                
                return [$year, $month, $day];
            } else {
                $passed -= 186;
            }
        } else {
            $year   -= 1;
            $passed += 179;
            
            if ($parsed['leap'] === 1) {
                $passed += 1;
            }
        }
        
        $month = 7 + self::division($passed, 30);
        $day   = ($passed % 30) + 1;
        
        return [$year, $month, $day];
    }
1171334
def julian_day(year, month=1, day=1):
    """"""
    janfeb = month < 3
    return (day
            + 1461 * (year + 4800 - janfeb) // 4
            + 367 * (month - 2 + janfeb * 12) // 12
            - 3 * ((year + 4900 - janfeb) // 100) // 4
            - 32075)
453429
public static String getDateAsString(final double JULIAN_DAY, final int TIMEZONE_OFFSET) throws Exception {
        if (JULIAN_DAY == -1) return "NO RISE/SET/TRANSIT FOR THIS OBSERVER/DATE";

        int date[] = SunMoonCalculator.getDate(JULIAN_DAY);
        return date[0] + "/" + date[1] + "/" + date[2] + " " + ((date[3] + TIMEZONE_OFFSET) % 24) + ":" + date[4] + ":" + date[5] + " UT";
    }
1285878
def dayname(year, month, day):
    '''
    
    '''
    legal_date(year, month, day)

    yearday = (month - 1) * 28 + day

    if isleap(year + YEAR_EPOCH - 1):
        dname = data.day_names_leap[yearday - 1]
    else:
        dname = data.day_names[yearday - 1]

    return MONTHS[month - 1], dname
1369959
public static function jdToGregorian($julian_day)
    {
        // PHP has different limits on 32 and 64 bit systems.
        $MAX_JD = PHP_INT_SIZE == 4 ? 536838866 : 2305843009213661906;

        return self::jdToCalendar(self::$gregorian_calendar, $julian_day, 1, $MAX_JD);
    }