Page 1 of 1

Simple date problem

Posted: Thu Mar 31, 2011 1:38 pm
by Zelenkooo
Is there any way to get next 10 dates ( for example ) next Tuesdays and Thursdays it should look like this:
5.april / 7.april / 12.april / 14.april / 19.april / 21.april / 26.april ...

Re: Simple date problem

Posted: Thu Mar 31, 2011 2:06 pm
by AbraCadaver
This is a popular homework assignment:

Code: Select all

$date = time();  //start date

$i = 0;
while(($date = strtotime('next Tuesday', $date)) && $i<5) {

    $result[] = date('j.F', $date);
    $result[] = date('j.F', strtotime('next Thursday', $date));
    $i++;
}
print_r($result);

Re: Simple date problem

Posted: Thu Mar 31, 2011 4:31 pm
by Zelenkooo
thx works great :D