|
Posted by NC on 12/07/06 03:39
wesley@ispace.co.za wrote:
>
> I have tried to use some of the functions you guys suggested.
> Some work fine but others like strtotime return results that i dont
> think are correct: This is what i have tried:
>
> echo strtotime('+ 1 month');
> The result is 1168074894
And why is it not correct? 1168074894 is the Unix time stamp for
some time on January 6, 2007... Have you read the PHP
documentation at all? If you did, you'd know that strtotime() returns
a timestamp and you will need to call date() to format a date
represented by that timestamp, like so:
echo date('Y-m-d', strtotime('+ 1 month'));
For more information, see:
http://www.php.net/strtotime
http://www.php.net/date
> I have also found another function to modify the date:
>
> $date = new DateTime("2006-12-12");
> $date->modify("+1 day");
> echo $date->format("Y-m-d");
>
> But this returns nothing. "DateTime" is not being recorgnized.
But of course it isn't. You try to refer to a class called DateTime;
as far as I can tell, this is not something that ships with PHP.
So you need to find out where this class came from and include()
the appropriate files...
> This function is supposed to be supported.
I don't think so. Not to mention the fact this is not a function,
but a class...
Cheers,
NC
[Back to original message]
|