The code I posted:
Start1 > = End2 OR Start2 > = End1
Negating this, you get the condition for a conflict. That is, you have a conflict if:
Start1 < End2 AND Start2 < End1
should work, except that I wanted to avoid conflicts for two datetime values. For dates, change the condition for no coincidence to:
Start1 > End2 OR Start2 > End1
and the condition for no coincidence (applying deMorgan's Law, IIRC) to:
Start1 < = End2 AND Start2 < = End1
Drawing two line segments of different length, on paper, one underneath the other, both with and without overlap, should make it clear.
>Hi Himlar,
>
>What I am try trying to achieve is this:
>
>I have 2 date ranges
>
>1. My user entered date range ie the date range the user wants to schedule in the diary.
>
>The treatment date range ie the usual date period in the year that the treatments is done.
>
>So if any of the dates between (or including) the start & end date of the user entered date range is between (or including) the treatment date range, then I want to do some code.
>
>Hope this is clear. In theory the treatment date range can be smaller than the entered date range or vice versa.
>
>TIA
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)