I have a past date of appointment set. Every new appointment is 8 days apart from the previous (past appointment+8 days). I would like to create a simple script to return the dates of appointments for the next 365 days starting from the current day each time (i.e. 0=< interval (today-appointment) =< 365).
I've tried something like this but I don't get what I want:
<?php
date_default_timezone_set('Europe/London');
$today = new DateTime("now");
$appointment=new DateTime('2013-08-26');
$interval = $appointment->diff($today)->d;
while ($interval <= 365 && $interval => 0)
{
echo $appointment->format('l n F Y');
$appointment->add(new DateInterval('P8D'));
} ?>