Ver Mensaje Individual
  #2 (permalink)  
Antiguo 27/06/2011, 12:21
Avatar de blakmetall
blakmetall
 
Fecha de Ingreso: diciembre-2010
Ubicación: Jalisco
Mensajes: 181
Antigüedad: 13 años, 4 meses
Puntos: 18
Respuesta: crear las fechas faltantes

Hola, estas son las clases de cosas que uno podria realizar, con un poco de imaginacion
y algunas funciones nativas de php no es dificil.

pero ya te hice algo que funciona bien, y si lo quieres modificar adelante.


Código PHP:
Ver original
  1. <?php
  2.     echo fechasEntre("2011-01-25","2011-02-10");
  3.    
  4.    
  5.     //fechas en formato "2010-02-25"
  6.     function fechasEntre($fecha1, $fecha2){
  7.         $tiempo1 = explode("-",$fecha1);
  8.         $tim1 = mktime(0,0,0,$tiempo1[1], $tiempo1[2], $tiempo1[0]);
  9.        
  10.         $tiempo2 = explode("-",$fecha2);
  11.         $tim2 = mktime(0,0,0,$tiempo2[1], ($tiempo2[2] - 1), $tiempo2[0]);
  12.        
  13.         $out = "";
  14.         while($tim1 < $tim2){
  15.             $elDia = $tim1 + 86400; // + 86400 (los segundos en un dia)
  16.            
  17.             $out .= date("Y-m-d",$elDia) . "<br />";
  18.            
  19.             $tim1 = $elDia;
  20.         }
  21.        
  22.         return $out;
  23.     }
  24.    
  25.     //resultados segun este caso
  26.    
  27.     /*
  28.     2011-01-26
  29.     2011-01-27
  30.     2011-01-28
  31.     2011-01-29
  32.     2011-01-30
  33.     2011-01-31
  34.     2011-02-01
  35.     2011-02-02
  36.     2011-02-03
  37.     2011-02-04
  38.     2011-02-05
  39.     2011-02-06
  40.     2011-02-07
  41.     2011-02-08
  42.     2011-02-09
  43.    
  44.     */
  45. ?>