PHP datetime value not passing in as a argument -
i using datetime object in php range of dates
however unable pass in value of datetime object function.
when try assigning variable, variable empty
code belows
$date1 = new datetime('2013-04-11'); $test = $date1->settime($i, 59); echo $test;
anyone idea how assign $date1 variable?
that returns datetime
object doesn't have tostring
method.
the above generate fatal error (you should enable errors):
catchable fatal error: object of class datetime not converted string in /code/khcgos on line 7
php catchable fatal error: object of class datetime not converted string in /code/khcgos on line 7
you should like:
echo $test->format('h:i:s d-m-y');
more info: http://codepad.viper-7.com/tnhglj
note: on production machine should have error reporting enabled, instead of displaying them should log them