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

search for in the

easter_days> <cal_to_jd
Last updated: Fri, 22 Aug 2008

view this page in

easter_date

(PHP 4, PHP 5)

easter_datedevuelve la marca de tiempo UNIX para la medianoche de Pascua de un año dado

Descripción

int easter_date ([ int $anno ] )

Devuelve la marca de tiempo UNIX que corresponde a la medianoche de Pascua del año dado.

A partir de PHP 4.3.0, el parametro anno es opcional y si se omite, usa por defecto el año en curso según "localtime".

Aviso: Esta función generará un aviso si el año está fuera del rango para las marcas de tiempo del UNIX (es decir, antes de 1970 o después del 2037).

Example #1 ejemplo de easter_date()

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" */

La fecha del Día de Pascua fue definida por el Concilio de Nicea en el 325 D.C. como el domingo tras la primera luna llena que cayera en ó después del equinoccio de Primavera. El equinoccio se supone que siempre cae en el 21 de marzo, de modo que el cálculo se reduce a determinar la fecha de la luna llena y la del domingo siguiente. El algoritmo usado aquí fue introducido en el año 532 por Dionisio Exiguo. Bajo el Calendario Juliano (para años anteriores al 1753), se usa un ciclo simple de 19 años para calcular las fases de la luna. Bajo el Calendario Gregoriano (años posteriores al 1753, diseñado por Clavio y Lilio, e introducido por el Papa Gregorio XIII en Octubre de 1582, y en Gran Bretaña y sus colonias en septiembre de 1752) se añaden dos factores de corrección para hacer el ciclo más preciso.

(El código se basa en un programa en C de Simon Kershaw, <webmaster@ely.anglican.org>)

Ver easter_days() para calcular la Pascua antes del 1970 o después del 2037.



easter_days> <cal_to_jd
Last updated: Fri, 22 Aug 2008
 
add a note add a note User Contributed Notes
easter_date
maxie
12-Jun-2008 10:36
To compute the correct Easter date for Eastern Orthodox Churches I made a function based on the Meeus Julian algorithm:

<?php
function orthodox_eastern($year) {
   
$a = $year % 4;
   
$b = $year % 7;
   
$c = $year % 19;
   
$d = (19 * $c + 15) % 30;
   
$e = (2 * $a + 4 * $b - $d + 34) % 7;
   
$month = floor(($d + $e + 114) / 31);
   
$day = (($d + $e + 114) % 31) + 1;
   
   
$de = mktime(0, 0, 0, $month, $day + 13, $year);
   
    return
$de;
}
?>
nigelf at esp dot co dot uk
28-Jan-2008 12:50
v5.2.1 - There is a known bug with easter_date() that can return incorrect dates for some years:

<?php
// 2008 OK
echo date("D d M Y", easter_date(2008));  // Sun 23 Mar 2008

// 2009 returns Saturday
echo date("D d M Y", easter_date(2009));  // Sat 11 Apr 2009
?>


However easter_days() works correctly:

<?php
echo date("D d M Y", strtotime("2009-03-21 +".easter_days(2009)." days"));  // Sun 12 Apr 2009
?>

It is apparently related to timezone settings.
14-Aug-2006 04:46
I made the function like this ... works fine !

<?php
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
08-Nov-2004 05: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;

   }
?>

easter_days> <cal_to_jd
Last updated: Fri, 22 Aug 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites