0

So I have this program for assigning people to projects. In my database I already have some samples projects with assigned employees. I have to be able to cross match my current project's start and end date to the projects that the employee is assigned too.

I can't do it like

if (this_StartDate == assignedProj_StartDate || this_EndDate == assignedProj_EndDate)

because that would only match the exact dates.

I need to be able to mark the employee available if this_StartDate & this_EndDate is not within the period of the assigned project to him. Help?

RMSP
  • 41
  • 2
  • 13
  • Duplicate question? http://stackoverflow.com/questions/3786821/check-if-a-date-range-is-within-a-date-range – emd Jan 10 '12 at 19:23

2 Answers2

1

It sounds like you want to check whether the the this range is outside of the assignedProj range:

if (this_StartDate > assignedProj_EndDate 
 || this_EndDate < assignedProj_StartDate)

This assumes that both ranges are valid (end > start)

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
0

the > and < signs might be useful to you

Keith Nicholas
  • 43,549
  • 15
  • 93
  • 156