El vie, 15-08-2014 a las 13:12 -0400, Lester Ramón González Alvarez
escribió:
> Hola a todos
> 
> Necesito un código o aplicación que dado un año me devuelva la fecha del
> primer viernes de luna llena después del equinoccio de primavera (21 de
> marzo)
> 
> Gracias
> 
> -- 
> MSc Lester Ramón González Alvarez
> Auditor Interno
> ONAT Villa Clara

Te pongo a continuación un programita en PHP que te calcula las
principales festividades. Haz un corta y pega y lo pones en /var/www/
o /var/www/html/ o donde corresponda.

Si no recuerdo mal, lo saqué del CD de la Enciclopedia Católica, y es el
que uso. ;-)

Ojo, que hasta donde sé, la Iglesia Ortodoxa toma en consideración otros
criterios y la Semana Santa no necesariamente coincide con la
católica/protestante.

******comienzo del código **********
<?php
function pascua ($anno)
{
# Constantes mágicas
$M = 24;
$N = 5;
#Cálculo de residuos
$a = $anno % 19;
$b = $anno % 4;
$c = $anno % 7;
$d = (19*$a + $M) % 30;
$e = (2*$b+4*$c+6*$d + $N) % 7;
# Decidir entre los 2 casos:
if ( $d + $e < 10 ) {
                        $dia = $d + $e + 22;
                        $mes = 3; // marzo
                    }
                    else {
                            $dia = $d + $e - 9;
                            $mes = 4; //abril
                        }
# Excepciones especiales (según artículo)
if ( $dia == 26  and $mes == 4 ) { // 4 = abril
                                    $dia = 19;
                                 }
if ( $dia == 25 and $mes == 4 and $d==28 and $e == 6 and $a >10 ) { // 4
= abril
                                                                    $dia
= 18;
                                                                  }
$ret = $dia.'-'.$mes.'-'.$anno;
return ($ret);
 }
         
 function mesespanol($m){
                            $m=intval($m);
                           $meses="No Especificado,
                           Enero,Febrero,Marzo,Abril,Mayo,Junio,Julio,
                           Agosto,Septiembre,Octubre,Noviembre,Diciembre";
                           $mes=explode(",",$meses);
                           $mesespan=$mes[$m];
                        return $mesespan;
                        }
function diaespanol($d){
                            $d=intval($d);
                           $dias="No Especificado,Lunes,Martes,

Mi&eacute;rcoles,Jueves,Viernes,S&aacute;bado,Domingo";
                          $dia=explode(",",$dias);
                         $diasspan=$dia[$d];
                        return $diasspan;
                        }
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Calcular Semana Santa | Pascua | PHP</title>
</head>
<body>
<center>
Tomado de http://www.asunfarra.com.py/pascua/ [Omar Albert]
<h1>Calcular Pascua:</h1>
<form action="index.php" name="forma" method="post">
<font face="Arial, Helvetica, sans-serif" size="2">
A&ntilde;o: <input type="text" name="anno" size="5" maxlength="4" 
value="<?php if(intval($_POST['anno']) > 0){ echo
intval($_POST['anno']); }else{ echo date("Y"); }?>">
<input type="submit" name="Go!" value="Calcular!">
</font>
</form>
</center>
<?php
#ejecutarlo pasando el año como parámetro.
if (isset($_POST['anno'])) {
                            $fecha = explode('-',pascua($_POST['anno']));
                            }
?><br />

<div align=center><font face=arial>
La pascua (domingo de resurrecci&oacute;n) 
en el a&ntilde;o introducido es el: 
<strong><?php echo $fecha[0]; ?> de <?php echo mesespanol($fecha[1]); ?>
de <?php echo $fecha[2]; ?></strong><br /><br />
<br />
<table width="400" cellspacing="0" cellpadding="0" style="margin:0px
auto;">
<tr>
<td colspan="3" align="center"><strong>Fechas especiales:</strong></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr bgcolor="#CCCCCC">
<td align="left"><strong><font
face="arial">Celebraci&oacute;n</font></strong></td>
<td align="center"><strong>D&iacute;a</strong></td>
<td align="center"><strong>Fecha</strong></td>
</tr>
<tr>
<td align="left"><strong>Domingo de Pascua</strong></td>
<td align="center"><?php echo diaespanol(date("N", mktime(0,0,0,
$fecha[1],$fecha[0],$fecha[2]))); ?></td>
<td align="center"><?php echo date("d/m/Y", mktime(0,0,0,$fecha[1],
$fecha[0],$fecha[2])); ?></td>
</tr>
<tr>
<td align="left">Mi&eacute;rcoles    de ceniza</td>
<td align="center"><?php echo diaespanol(date("N", mktime(0,0,0,
$fecha[1],$fecha[0]-46,$fecha[2]))); ?></td>
<td align="center"><?php echo date("d/m/Y", mktime(0,0,0,$fecha[1],
$fecha[0]-46,$fecha[2])); ?></td>
</tr>
<tr>
<td align="left">Domingo de Ramos</td>
<td align="center"><?php echo diaespanol(date("N", mktime(0,0,0,
$fecha[1],$fecha[0]-7,$fecha[2]))); ?></td>
<td align="center"><?php echo date("d/m/Y", mktime(0,0,0,$fecha[1],
$fecha[0]-7,$fecha[2])); ?></td>
</tr>
<tr>
<td align="left"><strong>Jueves Santo</strong></td>
<td align="center"><?php echo diaespanol(date("N", mktime(0,0,0,
$fecha[1],$fecha[0]-3,$fecha[2]))); ?></td>
<td align="center"><?php echo date("d/m/Y", mktime(0,0,0,$fecha[1],
$fecha[0]-3,$fecha[2])); ?></td>
</tr>
<tr>
<td align="left"><strong>Viernes Santo</strong></td>
<td align="center"><?php echo diaespanol(date("N", mktime(0,0,0,
$fecha[1],$fecha[0]-2,$fecha[2]))); ?></td>
<td align="center"><?php echo date("d/m/Y", mktime(0,0,0,$fecha[1],
$fecha[0]-2,$fecha[2])); ?></td>
</tr>
<tr>
<td align="left">Ascensi&oacute;n</td>
<td align="center"><?php echo diaespanol(date("N", mktime(0,0,0,
$fecha[1],$fecha[0]+39,$fecha[2]))); ?></td>
<td align="center"><?php echo date("d/m/Y", mktime(0,0,0,$fecha[1],
$fecha[0]+39,$fecha[2])); ?></td>
</tr>
<tr>
<td align="left">Pentecost&eacute;s</td>
<td align="center"><?php echo diaespanol(date("N", mktime(0,0,0,
$fecha[1],$fecha[0]+49,$fecha[2]))); ?></td>
<td align="center"><?php echo date("d/m/Y", mktime(0,0,0,$fecha[1],
$fecha[0]+49,$fecha[2])); ?></td>
</tr>
<tr>
<td align="left">Sant&iacute;sima Trinidad</td>
<td align="center"><?php echo diaespanol(date("N", mktime(0,0,0,
$fecha[1],$fecha[0]+56,$fecha[2]))); ?></td>
<td align="center"><?php echo date("d/m/Y", mktime(0,0,0,$fecha[1],
$fecha[0]+56,$fecha[2])); ?></td>
</tr>
<tr>
<td align="left">Corpus Christi</td>
<td align="center"><?php echo diaespanol(date("N", mktime(0,0,0,
$fecha[1],$fecha[0]+60,$fecha[2]))); ?></td>
<td align="center"><?php echo date("d/m/Y", mktime(0,0,0,$fecha[1],
$fecha[0]+60,$fecha[2])); ?></td>
</tr>
</table>
<br />
</font></div>
</div>

</body>
</html>

********fin del código ************
-- 
M.Sc. Alberto García Fumero
Usuario Linux 97 138, registrado 10/12/1998
Las autoridades sanitarias advierten:
El uso prolongado de Windows puede provocar dependencia.

-- 
Este mensaje ha sido analizado por MailScanner
en busca de virus y otros contenidos peligrosos,
y se considera que est� limpio.

------------ próxima parte ------------
A non-text attachment was scrubbed...
Name: index.php
Type: application/x-php
Size: 5900 bytes
Desc: no disponible
URL: 
<http://listas.jovenclub.cu/pipermail/gutl-l/attachments/20140815/17cb908c/attachment.bin>
______________________________________________________________________
Lista de correos del Grupo de Usuarios de Tecnologías Libres de Cuba.
Gutl-l@jovenclub.cu
https://listas.jovenclub.cu/cgi-bin/mailman/listinfo/gutl-l

Responder a