Skip to content

Instantly share code, notes, and snippets.

@globalideias
Created October 26, 2017 12:58
Show Gist options
  • Save globalideias/8fa8dde15ea31d4998f900edd610043d to your computer and use it in GitHub Desktop.
Save globalideias/8fa8dde15ea31d4998f900edd610043d to your computer and use it in GitHub Desktop.
<?php
$hoje = date("Y-m-d");
$inicio_turno_manha = "08:00";
$fim_turno_manha = "12:00";
$time_inicio_turno_manha = strtotime($hoje . $inicio_turno_manha);
$time_fim_turno_manha = strtotime($hoje . $fim_turno_manha);
$intervalo = (30 * 60); // meia hora
$i = $time_inicio_turno_manha;
while($i < $time_fim_turno_manha){
echo date("d/m/Y - H:i" , $i);
echo "<br/>";
$i += $intervalo;
}
@globalideias
Copy link
Author

Saida,

26/10/2017 - 08:00
26/10/2017 - 08:30
26/10/2017 - 09:00
26/10/2017 - 09:30
26/10/2017 - 10:00
26/10/2017 - 10:30
26/10/2017 - 11:00
26/10/2017 - 11:30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment