Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: easter_date - Manual
[go: Go Back, main page]

PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

easter_days" width="11" height="7"/> <cal_to_jd
Last updated: Thu, 31 May 2007

view this page in

easter_date

(PHP 4, PHP 5)

easter_date — 指定した年における復活祭の真夜中のUnix時を得る

説明

int easter_date ( [int $year] )

指定した年yearにおける復活祭の真夜中のUnix時を返します。

警告

この関数は、年がUnixタイムスタンプの範囲を越える時 (すなわち、1970より前、または2037より後)に警告を発生します。

復活祭の日付は、西暦325年の Nicaea 会議で春分の日の後の 最初の満月の後の日曜日として定められました。 満月とその次の日曜日の日付の計算を簡単にするために 春分の日は常に3月21日になるとして計算されます。 ここで用いるアルゴリズムは、532年頃、Dionysius Exiguus により 導出されたものです。(1753年より前の年に関して)ユリウス暦の元では 月の周期を追うために簡単な19年周期が用いられます。グレゴリウス暦 (1753年以降。この暦は、ClaviusとLiliusにより考案され、 教皇グレゴリウス13世により1582年10月に導入、イギリス及びその植民地に 1752年9月に導入された。) のもとで、二つの補正係数が周期をより正確に作成するために追加されました。

(このコードは、Simon Kershaw, <webmaster at ely.anglican dot org>によるCプログラムに基づくものです。)

パラメータ

year

1970 から 2037 までの年。

返り値

復活祭の日を Unix タイムスタンプで返します。

変更履歴

バージョン説明
4.3.0 以降 yearパラメータはオプションとなり 省略された場合には、ローカル時間に基づく現在の年がデフォルトとなります。

例 359. easter_date() の例

<?php

echo date("M-d-Y", easter_date(1999));        // Apr-04-1999
echo date("M-d-Y", easter_date(2000));        // Apr-23-2000
echo date("M-d-Y", easter_date(2001));        // Apr-15-2001

?>

参考

1970年以前または2037年以降の復活祭の計算に関しては、 easter_days() を参照ください。

参考

easter_days()



easter_days" width="11" height="7"/> <cal_to_jd
Last updated: Thu, 31 May 2007
 
add a note add a note User Contributed Notes
easter_date
14-Aug-2006 11:46
I made the function like this ... works fine !

function ostern
{
    $maerz21=date('z',mktime(0,0,0,3,21,$jb));

    $d=((15 + $jb/100 - $jb/400 - (8 * $jb/100 + 13) / 25)%30 + 19 * ($jb%19))%30;

    if ($d==29)
    {
        $D=28;
    }
    elseif($d==28 && ($jb%17)>=11)
    {
        $D=27;
    }
    else $D=$d;   

    $e=(2 * ($jb%4) + 4 *($jb%7) + 6 * $D + (6 + $jb/100 - $jb/400 - 2)%7)%7;

    $ostersonntag=$e+$D+1+$maerz21;
    return $ostersonntag;
}
phpuser
09-Nov-2004 01:17
The algorithm from Bigtree is correct if you add some (int) cast
<?php
  
function easter_date ($Year) {
  
      
/*
       G is the Golden Number-1
       H is 23-Epact (modulo 30)
       I is the number of days from 21 March to the Paschal full moon
       J is the weekday for the Paschal full moon (0=Sunday,
         1=Monday, etc.)
       L is the number of days from 21 March to the Sunday on or before
         the Paschal full moon (a number between -6 and 28)
       */
      

        
$G = $Year % 19;
        
$C = (int)($Year / 100);
        
$H = (int)($C - (int)($C / 4) - (int)((8*$C+13) / 25) + 19*$G + 15) % 30;
        
$I = (int)$H - (int)($H / 28)*(1 - (int)($H / 28)*(int)(29 / ($H + 1))*((int)(21 - $G) / 11));
        
$J = ($Year + (int)($Year/4) + $I + 2 - $C + (int)($C/4)) % 7;
        
$L = $I - $J;
        
$m = 3 + (int)(($L + 40) / 44);
        
$d = $L + 28 - 31 * ((int)($m / 4));
        
$y = $Year;
        
$E = mktime(0,0,0, $m, $d, $y);

         return
$E;

   }
?>
ray at non-aol dot com
07-Nov-2004 09:49
The algorithm from BigTree will throw an error in 2021 and 2025.  Better to install the PHP functions!  Details here:

http://aa.usno.navy.mil/faq/docs/easter.html
bigtree at 29a dot DONTSPAM dot nl
18-May-2002 12:41
A much smaller hack is the following. I ported this from a Delphi implementation of a function calculating easter dates.

<?php
   
function easter_date ($Year) {
   
       
/*
        G is the Golden Number-1
        H is 23-Epact (modulo 30)
        I is the number of days from 21 March to the Paschal full moon
        J is the weekday for the Paschal full moon (0=Sunday,
          1=Monday, etc.)
        L is the number of days from 21 March to the Sunday on or before
          the Paschal full moon (a number between -6 and 28)
        */
       

         
$G = $Year % 19;
         
$C = (int)($Year / 100);
         
$H = (int)($C - ($C / 4) - ((8*$C+13) / 25) + 19*$G + 15) % 30;
         
$I = (int)$H - (int)($H / 28)*(1 - (int)($H / 28)*(int)(29 / ($H + 1))*((int)(21 - $G) / 11));
         
$J = ($Year + (int)($Year/4) + $I + 2 - $C + (int)($C/4)) % 7;
         
$L = $I - $J;
         
$m = 3 + (int)(($L + 40) / 44);
         
$d = $L + 28 - 31 * ((int)($m / 4));
         
$y = $Year;
         
$E = mktime(0,0,0, $m, $d, $y);

          return
$E;

    }
?>

easter_days" width="11" height="7"/> <cal_to_jd
Last updated: Thu, 31 May 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites