Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/01/2011, 14:30
arros
 
Fecha de Ingreso: noviembre-2009
Mensajes: 535
Antigüedad: 14 años, 6 meses
Puntos: 25
ayuda con diffdate()

hola a todos
no se como explicar mi problema,
en prencipio quieroque salga las fechas atraves de un bucle FOR no se se estoy en buen camino o no ejemplo
aqui es me function:
Código PHP:
Ver original
  1. function diffdate($chIn, $chOut){
  2.    
  3. $i = strtotime($chIn);
  4. $o = strtotime($chOut);
  5. // get date
  6. $yearr = date('Y', $i);
  7. $endD = date('d', $o);
  8. $startD = date('d', $i);
  9. // get de las and first month form let to
  10. $startM = date('m', $i);
  11. $endM = date('m', $o);
  12. // get first and last year
  13. $primeranio= date('Y', $i);
  14. $ultimianio = date('Y', $o);
  15.  
  16. // get total days on each month
  17. $diasdeprimerlmes = date('t', $i);
  18. $diasdeultimolmes = date('t', $o);
  19. $dateDiff = $o - $i;
  20.  
  21. $fullDays = floor($dateDiff/(60*60*24));
  22. //echo $fullDays;
  23.  
  24. // calculate de las and the firs day at each month
  25.  
  26.  
  27.  
  28. for($r = $startD; $r <= $diasdeprimerlmes; $r++ )
  29. {
  30.    
  31.         echo $r."/".$startM."/".$yearr; echo '<br/>';
  32. if($r <= $diasdeprimerlmes)
  33. {
  34.     $r = $diasdeultimolmes++;
  35.     $startM = (date('n', $i)+1);
  36. }
  37. }
  38.  
  39. }
  40. $chIn = "2011-01-26";
  41. $chOut = "2011-02-02";
  42. diffdate($chIn, $chOut);
lo que quire es que me sale asi

26/01/2011
27/01/2011
28/01/2011
29/01/2011
30/01/2011
31/01/2011
01/02/2011
02/02/2011

o sea cuando el mes termina entra el otro mes con los dias corectos
gracias or adelantado