xpmen_phil
New Member
I need to find whether a new event created over laps any of the existing event.Event Table\[code\]ID EventName StartTime EndTime 1 Event1 11:30AM 12PM 2 Event2 11:30AM 11:40AM 3 Event3 11:40AM 12PM 4 Event4 12PM 12:30PM 5 Event5 11:30AM 12:30PM \[/code\]In above table, event 2 overlaps event 1, event 3 overlaps event 1, event 5 overlaps event 1...Current event start time and existing schedule end time, current end time and existing schedule start time can be same.I am trying to compare the whether the new event event time overlaps existing event time using the following logic but it fails\[code\]if (currentStartTime == schedule.StartTime){count++;continue;}else if (currentStartTime == schedule.EndTime){continue;}else if (currentEndTime == schedule.StartTime){continue;}else if (currentStartTime > schedule.StartTime && currentStartTime < schedule.EndTime && currentEndTime >= schedule.EndTime){count++;continue;}else if (currentEndTime <= schedule.EndTime && currentEndTime > schedule.StartTime && currentStartTime < schedule.StartTime){count++;continue;}\[/code\]