PHP Function Reference

PHP jdmonthname() Function



The PHP jdmonthname() function returns a string containing a month name. The mode parameter of this function specifies which calendar to convert the Julian Day Count to, and what type of month names are to be returned.

Syntax

jdmonthname(julian_day, mode)

Parameters

julian_day Required. Specify a Julian day number as integer.
mode Required. Specify the calendar mode (see table below).

Calendar modes

ModeValueDescriptionValues
CAL_MONTH_GREGORIAN_SHORT0Gregorian - abbreviatedJan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
CAL_MONTH_GREGORIAN_LONG1GregorianJanuary, February, March, April, May, June, July, August, September, October, November, December
CAL_MONTH_JULIAN_SHORT2Julian - abbreviatedJan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
CAL_MONTH_JULIAN_LONG3JulianJanuary, February, March, April, May, June, July, August, September, October, November, December
CAL_MONTH_JEWISH4JewishTishri, Heshvan, Kislev, Tevet, Shevat, AdarI, AdarII, Nisan, Iyyar, Sivan, Tammuz, Av, Elul
CAL_MONTH_FRENCH5French RepublicanVendemiaire, Brumaire, Frimaire, Nivose, Pluviose, Ventose, Germinal, Floreal, Prairial, Messidor, Thermidor, Fructidor, Extra

Return Value

Returns the month name for the given Julian Day and mode.

Exceptions

NA.

Example:

The example below shows the usage of jdmonthname() function.

<?php
//converting a Gregorian date to Julian integer 
$jd = gregoriantojd(10, 2, 2015);
  
//displaying the Julian day integer 
echo "The Julian day integer is: $jd \n";
  
//returning the month name
echo "The month is: ".jdmonthname($jd, 0)."\n";
echo "The month is: ".jdmonthname($jd, 
               CAL_MONTH_GREGORIAN_SHORT)."\n";
?>

The output of the above code will be:

The Julian day integer is: 2457298 
The month is: Oct
The month is: Oct

Example:

Consider one more example where other modes are used with this function.

<?php
//converting a Gregorian date to Julian integer 
$jd = gregoriantojd(10, 2, 2015);
  
//displaying the Julian day integer 
echo "The Julian day integer is: $jd \n";
  
//returning the month name
echo "The month is (mode=0) : ".jdmonthname($jd, 0)."\n";
echo "The month is (mode=1) : ".jdmonthname($jd, 1)."\n";
echo "The month is (mode=4) : ".jdmonthname($jd, 4)."\n";
?>

The output of the above code will be:

The Julian day integer is: 2457298 
The month is (mode=0) : Oct
The month is (mode=1) : October
The month is (mode=4) : Tishri

❮ PHP Calendar Reference