
05/02/2015, 05:26
|
| | Fecha de Ingreso: agosto-2012
Mensajes: 11
Antigüedad: 12 años, 7 meses Puntos: 1 | |
Respuesta: Liado en el trabajo con tiempo Cita:
Iniciado por Eleazan Uff, vaya coñazo!
La tabla me parece errónea (yo le pondría en vez de "INICIO" y "FIN", dos campos que fueran FechaInicio, y FechaFin!), pero bueno...
mas o menos, esta es la idea Código PHP: $sql->query("SELECT * FROM tablaeventos");
$tiempo = 0;
while($inicio = $sql->fetch()) {
//SUPONIENDO QUE SIEMPRE SEA UN INICIO EL PRIMER REGISTRO, Y UN FINAL EL SIGUIENTE
$fin = $sql->fetch();
$tiempo += (strtotime($fin['fecha'])-strtotime($inicio['fecha']));
}
echo "Han pasado ".$tiempo." segundos";
No se si ves la idea ;)
Muchas gracias por la rápida respuesta, voy a probar tu idea y te cuento. |