Ver Mensaje Individual
  #2 (permalink)  
Antiguo 05/04/2015, 12:26
Avatar de Djoaq
Djoaq
 
Fecha de Ingreso: septiembre-2012
Ubicación: Barcelona
Mensajes: 271
Antigüedad: 11 años, 7 meses
Puntos: 38
Respuesta: Graficar Horario en tabla

Simplemente ... debes recorrer entre la fecha y fín ... googleando un poco he visto :

Código PHP:
function createDateRangeArray($strDateFrom,$strDateTo) {
  
// takes two dates formatted as YYYY-MM-DD and creates an
  // inclusive array of the dates between the from and to dates.

  // could test validity of dates here but I'm already doing
  // that in the main script

  
$aryRange=array();

  
$iDateFrom=mktime(1,0,0,substr($strDateFrom,5,2),     substr($strDateFrom,8,2),substr($strDateFrom,0,4));
  
$iDateTo=mktime(1,0,0,substr($strDateTo,5,2),     substr($strDateTo,8,2),substr($strDateTo,0,4));

  if (
$iDateTo>=$iDateFrom) {
    
array_push($aryRange,date('Y-m-d',$iDateFrom)); // first entry

    
while ($iDateFrom<$iDateTo) {
      
$iDateFrom+=86400// add 24 hours
      
array_push($aryRange,date('Y-m-d',$iDateFrom));
    }
  }
  return 
$aryRange;

o

Código PHP:

$begin 
= new DateTime'2007-12-31' );
$end = new DateTime'2009-12-31 23:59:59' );

$interval DateInterval::createFromDateString('last thursday of next month');
$period = new DatePeriod($begin$interval$endDatePeriod::EXCLUDE_START_DATE);

foreach ( 
$period as $dt )
  echo 
$dt->format"l Y-m-d H:i:s\n" ); 
http://php.net/manual/es/class.dateperiod.php
http://boonedocks.net/mike/archives/...-with-PHP.html


Por cierto usa mysqli en vez de mysql..
Un saludo!