I have a table which has records of overlapping time-slots.
E.g.: Calendar(Id int, StartDate datetime, EndDate datetime, EventTitle nvarchar(100), ...)
The records would be like
- 01/20/2011 08:15 AM --- 01/20/2011 08:40 AM
- 01/20/2011 08:20 AM --- 01/20/2011 08:55 AM
- 01/20/2011 12:30 PM --- 01/20/2011 01:15 PM
- 01/20/2011 02:00 PM --- 01/20/2011 02:45 PM
- 01/20/2011 02:15 PM --- 01/20/2011 02:30 PM
- 01/21/2011 12:30 PM --- 01/21/2011 01:15 PM
- .......
- .......
The table represents the event schedule of a person
I want to club the overlapping slots together to give:
- 01/20/2011 08:15 AM --- 01/20/2011 08:55 AM
- 01/20/2011 12:30 PM --- 01/20/2011 01:15 PM
- 01/20/2011 02:00 PM --- 01/20/2011 02:45 PM
- 01/21/2011 12:30 PM --- 01/21/2011 01:15 PM
- ...
- ...
I am stuck at this part of the problem... (I removed my code that I pasted here, as it looks mangled. I am using stackoverflow for the first time.)
Part of my actual requirement is to find a time slot [t] (let's say 25 minutes) between two given dates, which I can accommodate into the schedule. [t] has to be found between 8:00 AM and 05:00 PM on any day.