Ver Mensaje Individual
  #5 (permalink)  
Antiguo 24/02/2012, 12:39
Avatar de andresdzphp
andresdzphp
Colaborador
 
Fecha de Ingreso: julio-2011
Ubicación: $this->Colombia;
Mensajes: 2.749
Antigüedad: 12 años, 9 meses
Puntos: 793
Respuesta: Ciclo que muestre fechas

Bueno hay muchas formas y miles de ejemplos, te dejo un par:

Código PHP:
Ver original
  1. <?php
  2. $fecha = '20-02-2012';
  3. $f1 = strtotime($fecha);
  4. $f2 = time();
  5. $r = floor(($f2-$f1) / (60 * 60 * 24));
  6.  
  7. for ($i = 0; $i <= $r; $i++) {
  8.     echo date('d-m-Y', strtotime("$fecha + $i day")) . '<br />';
  9. }
  10. ?>

Código PHP:
Ver original
  1. <?php
  2. $startDate = new DateTime('20-02-2012');
  3. $endDate = new DateTime('now');
  4.  
  5. while($startDate->getTimestamp() <= $endDate->getTimestamp()){
  6.     echo $startDate->format('d-m-Y') . '<br/>';
  7.     $startDate->modify("+1 days");
  8. }
  9. ?>
__________________
Si sabemos como leer e interpretar el manual será mucho más fácil aprender PHP. En lugar de confiar en ejemplos o copiar y pegar - PHP