in reply to Calculate seconds between dates
Any one of several date/time packages (including those that are built in to the core) will provide you with the inclusive number of days between two dates, which is the starting point. Some will even handle holidays and weekends for you, but if not it's still relatively easy. In every case, the first and the last whatever-it-is (day, week ...) are the ones that require special consideration. If you do find a package that will handle the days for you, then all that remains is to calculate the relevant portion of the first day and of the last one. And some of that is up-to-you: for instance, what if the ending-time was 6:00 pm?