I have always looked for this, but the answer seems nowhere. Here's the problem:
Say I have two date ranges.
$daterange1 = 2012-04-20 till 2012-04-28 $daterange2 = 2012-04-18 till 2012-05-01
Now I would like to know if daterange2 is within daterange1. But, as you can see, daterange2 is only partially within daterange1. Is there a way to return 3 variables, for example:
- 2012-04-18 to 2012-04-20
- 2012-04-20 - 2012-04-28
- 2012-04-28 to 2012-05-01
I know this sounds a little vague, but I really don't know how to explain it differently.
source share