Ver Mensaje Individual
  #11 (permalink)  
Antiguo 26/10/2007, 03:53
dualklip
 
Fecha de Ingreso: octubre-2007
Ubicación: Madrid, España
Mensajes: 221
Antigüedad: 16 años, 7 meses
Puntos: 5
Re: PHP. Problema con fechas

Encontre otra fórmula mejor:

Código PHP:
<?php
$fecha_inicio 
'2007-10-01';
$fecha_fin '2007-10-31';
$inicioEnSeg strtotime($fecha_inicio);
$finEnSeg strtotime($fecha_fin);
$totalDias = ($finEnSeg $inicioEnSeg)/(60*60*24);
echo 
'La fecha de inicio es '.$fecha_inicio.'. Si la transformamos a segundos nos da '.$inicioEnSeg.'<br>';
echo 
'La fecha de fin es '.$fecha_fin.'. Si la transformamos a segundos nos da '.$finEnSeg.'<br>';
echo 
'Me salen '.$totalDias.' días, que en fecha se convierten en:<br>';
echo 
'estamos en la zona horaria '.date_default_timezone_get().'<br>';
for(
$a 0$a <= $totalDias$a++){
    
$fecha date('d-M-Y',strtotime('+'.$a.' days'$inicioEnSeg));
    echo 
$fecha.'<br>';
};
?>
detalle:
Código PHP:
strtotime('+'.$a.' days'$inicioEnSeg