Also, be aware that the eastern orthodox churches sometimes have different dates for easter. See, for example <http://webexhibits.org/calendars/calendar-christian-easter.html>. And note that the dates of easter a subject to change, for example, the churches might some day decide to unify the dates.
easter_days
(PHP 4, PHP 5)
easter_days — 指定した年において、3 月 21 日から復活祭までの日数を得る
説明
$year
[, int $method = CAL_EASTER_DEFAULT
]] )指定した年 year において、3 月 21 日から復活祭までの日数を返します。 year が指定されない場合、現在の年が仮定されます。
この関数は、Unix 時の範囲外(すなわち 1970 年以前または 2037 年以降)の復活祭を 計算するために easter_date() の代わりに使用することが できます。
復活祭の日付は、西暦 325 年の Nicaea の会議で春分の日以降の 最初の満月の後の日曜日として定義されました。 満月とその次の日曜日の日付の計算を簡単にするために 春分の日は常に 3 月 21 日になるとして計算されます。 ここで用いるアルゴリズムは、532 年頃に Dionysius Exiguus により 導出されたものです。(1753 年より前の年に関して)ユリウス暦のもとでは 月の周期を追うために簡単な 19 年周期が用いられます。グレゴリオ暦 (1753 年以降。この暦は Clavius と Lilius により考案され、 教皇グレゴリウス 13 世により 1582 年 10 月に導入、イギリス及びその植民地に 1752 年 9 月に導入された) のもとで、二つの補正係数が周期をより正確に作成するために追加されました。
パラメータ
-
year -
正の数値で表した年。
-
method -
CAL_EASTER_ROMANに設定すると 1582 年から 1752 年までの復活祭の日付をグレゴリオ暦にもとづいて 計算します。それ以外に使用可能な定数については カレンダー定数を参照ください。
返り値
指定した年 year において、3 月 21 日から復活祭までの日数を返します。
変更履歴
| バージョン | 説明 |
|---|---|
| 4.3.0 以降 |
year はオプションのパラメータとなり、
もし指定されなかった場合は、地方時にもとづいた現在の年がデフォルトとなります。
|
| 4.3.0 以降 |
method パラメータが追加されました。
|
例
例1 easter_days() の例
<?php
echo easter_days(1999); // 14, i.e. April 4
echo easter_days(1492); // 32, i.e. April 22
echo easter_days(1913); // 2, i.e. March 23
?>
This function appears to be Britanno-centric. When attempting to calculate the Gregorian date for Easter for years prior to 1753, the function returns the number or days since March 21st in the Julian Calendar, even though the Gregorian system was in effect in the rest of Europe since 1582. If you wish to calculate the date of easter for a Gregorian date from 1582 onward, use the following function, which duplicates the funcionality of easter_days:
<?php
function easter_days2($year) {
#First calculate the date of easter using Delambre's algorithm.
$a = $year % 19;
$b = floor($year / 100);
$c = $year % 100;
$d = floor($b / 4);
$e = $b % 4;
$f = floor(($b + 8) / 25);
$g = floor(($b - $f + 1) / 3);
$h = (19 * $a + $b - $d - $g + 15) % 30;
$i = floor($c / 4);
$k = $c % 4;
$l = (32 + 2 * $e + 2 * $i - $h - $k) % 7;
$m = floor(($a + 11 * $h + 22 * $l) / 451);
$n = ($h + $l - 7 * $m + 114);
$month = floor($n / 31);
$day = $n % 31 + 1;
#Return the difference between the JulianDayCount for easter and March 21'st
#of the same year, in order to duplicate the functionality of the easter_days function
return GregorianToJD($month, $day, $year) - GregorianToJD(3,21,$year);
}
?>
