• If you've already got a time dimension it should be be too hard from there.

    First, a question, do you include an hour if the start is during that hour (same for end)?

    For example, if it comes in at 0841, should the 8 oclock hour get a 1? If it leaves at 0901, should the 9 oclock hour get a 1?

    What you are basically going to do is join to your time dimension based on the two dates, grouping based on hours. But the particulars come down to your table definitions and your requirements (hence the question above)