How to add days to date in PHP?

Joined
Mar 31, 2008
Messages
630
Reaction score
462
i have a list of elements that i need to be added by date :

2008-06-25 [xxxxxxxx]
2008-06-26 [xxxxxxxx]
2008-06-27 [xxxxxxxx]
2008-06-28 [xxxxxxxx]
2008-06-29 [xxxxxxxx]
2008-06-30 [xxxxxxxx]
2008-07-1 [xxxxxxxx]
2008-07-2 [xxxxxxxx]
................

the list is too long to add dates manually .

i tried with :

echo 'Next Day: '. date('Y-m-d', strtotime('+1 days')) ."\n";

works just for next day...


should be something like count ... $count++; print ( "(".$count." .......

anyone please help ?
 
Thanks Raimis.
worked with this:
print ('Next Day: '. date('Y-m-d', strtotime("+$I days")) ."\n");
$I++;

Code:
for ($I = 0; $I < 30; $I++) {

echo 'Next Day: '. date('Y-m-d', strtotime("+$I days")) ."\n";

}



Try this
 
Back
Top