Ver Mensaje Individual
  #2 (permalink)  
Antiguo 01/12/2012, 08:28
jmdearpe
 
Fecha de Ingreso: noviembre-2012
Mensajes: 66
Antigüedad: 11 años, 5 meses
Puntos: 10
Respuesta: Problema con la función date en php

Hola, es mejor que user mktime para trabajar con timestamps y recojas la fecha actual en ese formato con time()

http://php.net/manual/es/function.time.php
http://php.net/manual/es/function.mktime.php

Código PHP:
<?php

$dia
=time();
//     int mktime ([ int $hour = date("H") [, int $minute = date("i") [, int $second = date("s") [, int $month = date("n") [, int $day = date("j") [, int $year = date("Y") [, int $is_dst = -1 ]]]]]]] )
$fecha1=mktime(0,0,0,11,30,2012);
$fecha2=mktime(0,0,0,12,15,2012);
$fecha3=mktime(0,0,0,12,17,2012);
$fecha4=mktime(0,0,0,1,11,2012);

if (
$dia>$fecha1 && $dia<$fecha2)
{
echo
'<div class="seminario"><p>NUEVO SEMINARIO NAVIDEÑO!!!</p>';

echo 
'<p>Infórmate <a href="sem_mu.html"> acá</a></p></div>';
}
elseif(
$dia>$fecha3 && $dia<$fecha4)
{
echo
'<div class="seminario"><p>NUEVO SEMINARIO DE PINTURA EN PORCELANA!!!</p>';

echo 
'<p>Infórmate <a href="sem_vina.html"> acá</a></p></div>';
}

?>
Saludos