$columns = array('mon','thu','wed','tue', 'fri', 'sat', 'sun');
$num_cols = count($columns);
echo "<table>";
echo "<tr>";
foreach($columns as $col)
{
echo "<td>$col</td>";
for($i=1;$i<20;$i++)
{
echo "<tr>";
$datetime = new DateTime();
for($j=0;$j<$num_cols;$j++){
$datetime->modify('+30 minutes');
echo '<td>' . $datetime->format('H:i:s') . '</td>';
}
echo "</tr>";
}
}
echo "</tr>";
echo "</table>";
How can i modify this for:
mon | thu etc
10:10:10 | 10:10:10
10:40:10 | 10:40:10
11:10:10 | 11:10:10
etc
Now this bad working. I would like create simple calendar. This generated for me to many hours for one day.
Thanks for help!
Edit:
If this is simply i can use only one loop for – with hours – without $columns. but how can i make it?
i would like receive:
10:10:10 | 10:10:10 etc
10:40:10 | 10:40:10
11:10:10 | 11:10:10
etc
with $datetime->format(‘Y-m-d H:i:s’) 🙂 i dont know how i can show this is columns – from top to down, not from left to right
1 Answer