Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kingjmaningo/c01673a3d3fdb0aba67316de9b3fb01e to your computer and use it in GitHub Desktop.
Save kingjmaningo/c01673a3d3fdb0aba67316de9b3fb01e to your computer and use it in GitHub Desktop.
Get 30 min interval between two time
<?php
$time_start = 1619164800; //8:00:00 AM converted to integer
$time_end = 1619197200; //5:00:00 PM converted to integer
$interval = 1800; // 30min interval in seconds
$x = 1;
for( $item_time = $time_start; $item_time < $time_end; $item_time += $interval ) {
echo date('g:i a', $item_time); ?>
$x++;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment