Calendar 函数
在线手册:中文  英文

JDMonthName

(PHP 4, PHP 5)

JDMonthName返回月份的名称

说明

string jdmonthname ( int $julianday , int $mode )

返回一个月份名称的字符串,mode参数指定使用哪种历法和月份名称的形式。

Calendar modes
Mode Meaning Values
0 Gregorian - abbreviated Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
1 Gregorian January, February, March, April, May, June, July, August, September, October, November, December
2 Julian - abbreviated Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
3 Julian January, February, March, April, May, June, July, August, September, October, November, December
4 Jewish Tishri, Heshvan, Kislev, Tevet, Shevat, AdarI, AdarII, Nisan, Iyyar, Sivan, Tammuz, Av, Elul
5 French Republican Vendemiaire, Brumaire, Frimaire, Nivose, Pluviose, Ventose, Germinal, Floreal, Prairial, Messidor, Thermidor, Fructidor, Extra

参数

jday

用来计算的julian天数

calendar

历法的月份的名字

返回值

根据指定的julian天数和calendar历法参数而得到月份的名称。


Calendar 函数
在线手册:中文  英文

用户评论:

marc at linkitdesign dot com (2013-06-15 13:58:52)

Regarding the jewish date system. It may be worth noting the following peculiarities, some obvious some not so.
1. Jewish days start at sunset NOT midnight so when converting from a Gregorian date to a Jewish one it might be worth asking if the date/time occurred 'after sunset'.
2. Jewish leap years follow a 19 year cycle which can be calculated like this:
function isJLeapYear($JYear) {
if ( ((7 * $JYear + 1) % 19) < 7 )
return true;
else
return false;
}
3. During a leap year a new leap-month called "Adar I" is inserted BEFORE the normal month of Adar.
4. During leap years, Adar is renamed "Adar II".
5. Adar/Adar II has 29 days
6. Adar I has 30 days
7. Cheshvan & Kislev have between 29 & 30 Days
8. Leap years have between 383 and 385 days.
8. non-leap years have between 353 and 355 days.
9 . In a 354-day year, months have alternating 30 and 29 day lengths.
10. In a 353-day year, the month of Kislev is reduced to 29 days.
11. In a 355-day year, the month of Cheshvan is increased to 30 days.
12. Leap years years follow the same pattern, with the addition of the 30-day Adar I as well.

doug at exploittheweb dot com (2012-07-09 21:16:16)

<?php

/* Simplest way to get current abbreviated month name */

echo date('M');

?>

viju dot kantah at gmail dot com (2011-11-20 22:34:33)

<?php

/* Simple way to get current month name */

$mons = array(=> "Jan"=> "Feb"=> "Mar"=> "Apr"=> "May"=> "Jun"=> "Jul"=> "Aug"=> "Sep"10 => "Oct"11 => "Nov"12 => "Dec");

$date getdate();
$month $date['mon'];

$month_name $mons[$month];

echo 
$month_name// Displays the current month

?>

asphp at dsgml dot com (2011-04-17 02:58:59)

Use this function if you prefer to use the standard calendar constants:

<?php
function jdmonthname2($julianday$calendar$abbrev false) {
  if(
$calendar == CAL_GREGORIAN && $abbrev$mode 0;
  elseif(
$calendar == CAL_GREGORIAN && !$abbrev$mode 1;
  elseif(
$calendar == CAL_JULIAN && $abbrev$mode 2;
  elseif(
$calendar == CAL_JULIAN && !$abbrev$mode 3;
  elseif(
$calendar == CAL_JEWISH$mode 4;
  elseif(
$calendar == CAL_FRENCH$mode 5;
  else 
$mode 10//use an invalid mode and let the underlying function handle it

  
return jdmonthname($julianday$mode);
}
?>

ukarmakar at gmail dot com (2009-12-28 23:40:22)

You can get the month name by passing the month integer value to a simple function....

<?php
function getMonthName($Month){
    
$strTime=mktime(1,1,1,$Month,1,date("Y"));
    return 
date("F",$strTime);
}
echo 
getMonthName(10);
?>

Output:
October

Shai (2005-09-24 15:12:14)

YIQV, this should correct your issue with Adar being displayed as AdarI:

<?php

// assuming that $jewish_month is the Jewish month,
// and $jewish_year is the Jewish year,
// you can use this script to replace 'Adar I' with 'Adar' when it is not a leap year.
// this is because a Jewish leap year occurs every 3rd, 6th, 8th, 11th, 14th, 17th, and 19th year.

if(    $jewish_month == "AdarI" &&
    
$jewish_year%19 != &&
    
$jewish_year%19 != &&
    
$jewish_year%19 != &&
    
$jewish_year%19 != &&
    
$jewish_year%19 != 11 &&
    
$jewish_year%19 != 14 &&
    
$jewish_year%19 != 17
) {

    
$jewish_month "Adar";

}

?>

YIQV (2005-01-30 10:47:00)

I am finding an inconsistency in the Jewish month Adar. The function always returns AdarI regardless of whether the year is a jewish leapyear. The month is known as Adar (not AdarI) in non-leap years. Also when using function jdtojewish with bool hebrew set to true it always returns (ADR) and not (ADR A) when it's a leap year. AdarII in Hebrew and English seems to work properly.

易百教程