Comparing times

  • Thread starter Thread starter The Iconoclast
  • Start date Start date
T

The Iconoclast

Greetings to all!
I am trying to find out an efficient way of determining whether two or
more time scheds are in conflict.
Example:
Subj A - 9:00 am to 10:30 am - Mondays
Subj B - 9:30 am to 11:00 am - Mondays
Subj C - 10:30 am to 12:00 pm - Mondays
Subj D - 9:00 am to 10:30 am - Tuesdays
etc.

When comparing all subjects, (A and B) and (C and B) are in conflict
while (A and D) and (A and C) are not.

Are there any efficent routines that can do this?

Any help would be much appreaciated. Thank you in advance.

-MEM
 
Hi,
for such things i am using following function:

Public Function IsOverlapping(ByVal Per1Beg As Date, _
ByVal Per1End As Date, _
ByVal Per2Beg As Date, _
ByVal Per2End As Date) As Boolean

If Per1Beg <= Per2Beg And Per1End <= Per2Beg Then Exit Function
If Per1Beg >= Per2End Then Exit Function

IsOverlapping = True
End Function

if Per1 and Per2 overlapping - it returns true
HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top