Foros del Web » Programando para Internet » PHP »

Ayuda en calendario

Estas en el tema de Ayuda en calendario en el foro de PHP en Foros del Web. Hola listeros ya tengo un calendario en PHP, les muestro el codigo <?php function DayInMonth($month, $year) { $daysInMonth = array(31, 28, 31, 30, 31, 30, ...
  #1 (permalink)  
Antiguo 26/06/2008, 14:48
 
Fecha de Ingreso: marzo-2006
Mensajes: 110
Antigüedad: 18 años, 1 mes
Puntos: 0
Ayuda en calendario

Hola listeros ya tengo un calendario en PHP, les muestro el codigo

<?php function DayInMonth($month, $year) {
$daysInMonth = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
if ($month != 2) return $daysInMonth[$month - 1];
return (checkdate($month, 29, $year)) ? 29 : 28;
}
$month = date("n");
$mes=array(1 => "Enero",
2 => "Febrero",
3 => "Marzo",
4 => "Abril",
5 => "Mayo",
6 => "Junio",
7 => "Julio",
8 => "Agosto",
9 => "Septiembre",
10 => "Octubre",
11 => "Noviembre",
12 => "Diciembre"
);
$year = date("Y");
$day = date("j");
$fecha_mes=$year."/".$day."/".$month;

//echo DayInMonth($month,$year);
$date = DayInMonth($month,$year);
$mesa=$month-1;
$anoa=$year;
if ($mesa==0)
{
$anoa--;
$mesa=12;
}
$mess = $month + 1;
$anos = $year;
if ($mess==13){
$anos++;
$mess=1;
}
echo'<table width="4%" border="1" cellspacing="0" cellpadding="0">';

echo '<tr bgcolor="#0099FF"><td><a href="reservar.php?">Año Anterior</a></td><td><a href="#">Mes Antrerior</a></td>
<td colspan="2" align="center" style="color:#ffffff">'.$meses=$mes[$month].'</td>
<td align="center" style="color:#ffffff">'.$year.'</td>
<td><a href="#">Mes Siguiente</a></td><td><a href="#">Año Siguiente</a></td></tr>';
echo '<tr bgcolor="#0099FF">
<td> <div align="center"><font color="#FFFFFF"><strong>Lunes</strong></font></div></td>
<td><div align="center"><font color="#FFFFFF"><strong>Martes</strong></font></div></td>
<td><div align="center"><font color="#FFFFFF"><strong>Miercoles</strong></font></div></td>
<td><div align="center"><font color="#FFFFFF"><strong>Jueves</strong></font></div></td>
<td><div align="center"><font color="#FFFFFF"><strong>Viernes</strong></font></div></td>
<td><div align="center"><font color="#FFFFFF"><strong>Sabado</strong></font></div></td>
<td><div align="center"><font color="#FFFFFF"><strong>Domingo</strong></font></div></td>
</tr>';

///creamos el objeto
//$pinta1= new pinta($dia,$diaf);

for($j = 1; $j < $date + 1; $j++) {

?>
<td bgcolor=<?php ?> <?php if(pinta($j,$dia,$diaf)==1){ ?> "yellow" <?php
}
if(pinta2($j,$diar,$diarf)==1){ ?> "red" <?php
}else{ ?> "green" <?php } ?> >
<?php
echo $j;
?>
</td>
<?php


if($j % 7 == 0)
echo "</tr><tr>";


}

echo '</tr>';
echo '</table>';

Las funsiones son para poder pintar los eventos.

La pregunta es de que como le hago para poder regresar al mes anterior o darle al mes posterior, asi como los años. Gracias por ayudar
  #2 (permalink)  
Antiguo 26/06/2008, 14:53
Avatar de emiliodeg  
Fecha de Ingreso: septiembre-2005
Ubicación: Córdoba
Mensajes: 1.830
Antigüedad: 18 años, 7 meses
Puntos: 55
Respuesta: Ayuda en calendario

revisa mktime();
__________________
Degiovanni Emilio
developtus.com
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:27.