I have a MySQL table with a time
field that stores the time a commercial has been published. I need to group them by periods of 15 minutes and display.
Example:
|comm1|comm2 |comm3|
--------------------------------
|8:00- 8:15 | 2 | 5 | 0 |
--------------------------------
|8:15- 8:30 | 0 | 0 | 1 |
--------------------------------
|8:30- 8:45 | 4 | 1 | 3 |
--------------------------------
|8:45- 9:00 | 4 | 5 | 2 |
--------------------------------
|... | . | . | . |
--------------------------------
and so on till 24:00! So, I need two things to do:
1) the division in periods of 15 minutes of all day, and
2) round the time a commercial has run, to the nearest of these periods.
Any idea? I can use only PHP/MySQL.