Ver Mensaje Individual
  #3 (permalink)  
Antiguo 16/08/2009, 08:22
albert1980
 
Fecha de Ingreso: julio-2009
Mensajes: 118
Antigüedad: 15 años, 6 meses
Puntos: 2
Respuesta: Problemilla con fechas

Se entiende :p

lo que deberías de hacer es marcar un día menos si estamos entre las 00:00 y las 09:00, algo así:

Código PHP:
<?
include_once("admin/conexion.php");

try{
    
$dbh=conectar();
                   
    
$stmt4=$dbh->query("SELECT fecha_id,farmacia, lugar FROM farmacias");
}catch (
PDOException $e){
    echo 
"Error en la consulta: ";
}


$time time();

if((
date('G') >= 0) and (date('G') < 9))
$time -= 3600*9;//le quitamos 9 horas por redondear

    
$fecha_a=date('Y-m-d'$time);

    
$row4=$stmt4->fetch();
    while(
$row4){
?>
<? $fecha
$row4["fecha_id"];

        if (
$fecha === ($fecha_a)){
?>
<?
$farmacia
$row4["farmacia"];
$lugar$row4["lugar"];
$fecha_farmacia=$row4["fecha_id"];
?>
<table>
        <tr>
            <td><p><?=$farmacia?></p></td>
        </tr>
        <tr>
            <td><p><?=$lugar?></p></td>
        </tr>
        <tr>
            <td><p><?=$fecha_farmacia?></p></td>
        </tr>

    </table>
<?
}
$row4=$stmt4->fetch();
$dbh=NULL;

}
Saludos!
__________________
Todo sobre programación en PHP