i got 3 different Datetimes. $start_date
and $end_date
are the given range of dates i work with. What i need is to find the $date_from_user
in this range, what is not the problem, i found plenty of solutions for that, like this SO answer.
But what i need is then to tell what exact day the $date_from_user
is in the given Daterange.
So taken from the example below the expected result would be 5
.
$start_date = '2009-09-05';
$end_date = '2009-09-17';
$date_from_user = '2009-09-10';
How can i get the number of the day from the range?
I thought for myself about an for
loop to compare the date, but that would be problematic if the Daterange is larger than a month.