I hope that someone can help me out. I am trying to build a dropdown menu, which shows the next 4-6 tuesdays with the correct date. This is already working. Problem now is, that I need the following:
If today is wednesday, the dropdown should start with the first tuesday BUT not from next week, instead with the tuesday from the week after next week. Why? Because I always need full 7 days between the registration and the delivery time.
So if today is monday, the next (first) tuesday should be the tuesday from next week. Also lets say today is friday, then my dropdown should not start with the tuesday from next week, instead with the tuesday from the week after next week.
Something like: Today is Monday - tomorrow will be tuesday but there are not 7 days between so the tuesday from next will should be shown.
Here is what I have so far:
$begin = new DateTime('tuesday this week');
$end = new DateTime('last tuesday of next month');
$interval = new DateInterval( 'P1W' );
$daterange = new DatePeriod( $begin, $interval ,$end );
<select class='form-control margin-bottom-20' name='delivery_first' required>
foreach($daterange as $date){
<option value='".$date->format('d.m.Y')."'>"; echo $date->format('l'); echo $date->format('d.m.Y'); print"</option>
}
</select>
Any idea how I can implement the check, if 7 days are between? Hope my question is clear. If not please let me know.