views:

23

answers:

1

I have a database holding events in the form of a start_time and an end_time which are timestamps. I am trying to make a calendar that has 24 rows, and 7 columns.

A normal calendar would be easier for me to create because my SQL results would be in order of lowest to highest.

I am not quite sure how I would run through my SQL table, and display hourly for each day to make the html work

i.e:

12:00am | m | t | w | t | f | s | s

Any information at all on the best way to do this would be appreciated.

A: 

You should convert your timestamps into epoch seconds. Then obtain length of event in seconds by end_time-start_time

Depending on the height of your 24-row table, each second (or 60 seconds) would correspond to some count of pixels.

You can create floating divs of the appropriate height using this math. Only problem may arise if an event goes overnight onto the next day.

Mikhail