Click to See Complete Forum and Search --> : relative dates - srtotime() and date()


richfm
09-01-2007, 02:27 PM
HI All,
I spent an age trying to find the syntax for this, googled everywhere and all sorts.

It seems PHP5 now has a class....but my site was on PHP4.x

I'm posting this so no one else has to spend time on this issue or get lumberd with a shed load of code. Here it is nice and simple.

<?php
$datevar = strtotime("2007-07-31");
print date( 'd/m/Y', $datevar )."<br>";
for ($i=1;$i<=5;$i++){
$datevar = strtotime("+1 day", $datevar);
print date( 'd/m/Y', $datevar )."<br>";
}
?>

Best regards
RichFM

bradgrafelman
09-02-2007, 02:06 AM
I'm confused... what's the problem? Is there an error message you're getting or ... ?

EDIT: ... Or are you just sharing some code of yours? I think, after re-reading your post, this is what you meant, so I've moved this thread to the Code Critique forum.