PHP, see if date range is partly within another date range
问题 I've been looking forever for this, but the answer seems nowhere. Here's the problem: Say, I've got two date ranges. $daterange1 = 2012-04-20 till 2012-04-28 $daterange2 = 2012-04-18 till 2012-05-01 Now, I'd like to know if daterange2 is within daterange1. But, as you can see, daterange2 only partly is within daterange1. Is there any way of getting 3 variables back, something like: 2012-04-18 till 2012-04-20 2012-04-20 till 2012-04-28 2012-04-28 till 2012-05-01 I know it sounds a little vague