Simple date problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Zelenkooo
Forum Newbie
Posts: 2
Joined: Thu Mar 31, 2011 1:29 pm

Simple date problem

Post 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 ...
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Simple date problem

Post 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);
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Zelenkooo
Forum Newbie
Posts: 2
Joined: Thu Mar 31, 2011 1:29 pm

Re: Simple date problem

Post by Zelenkooo »

thx works great :D
Post Reply