Ver Mensaje Individual
  #2 (permalink)  
Antiguo 27/01/2015, 13:52
Avatar de hhs
hhs
Colaborador
 
Fecha de Ingreso: junio-2013
Ubicación: México
Mensajes: 2.995
Antigüedad: 10 años, 10 meses
Puntos: 379
Respuesta: Dividir horario cada 20 min según hora-inicio hora-fin establecidos?

La idea basica es la siguiente:
Código PHP:
Ver original
  1. $interval = new DateInterval('PT20M');
  2. $start = new DateTime('10:40');
  3. $end = (new DateTime('13:00'))->modify('+20 min');
  4. $period = new  DatePeriod($start,$interval,$end);
  5.  
  6. foreach($period as $date)
  7. {
  8.     echo $date->format('H:i') . '<br>';
  9. }
Los detalles están en la documentación: http://php.net/manual/en/book.datetime.php
__________________
Saludos
About me
Laraveles
A class should have only one reason to change.