Using the DateTime
class, if I try to run the following code:
$mydate = new DateTime();
echo $mydate->date;
I\'ll get back
If you just use a var_Dump before ask the property date everything works allright:
$mydate = new DateTime();
var_Dump($mydate);
echo '
';
echo $mydate->date;
This delivers:
object(DateTime)#1 (3) { ["date"]=> string(26) "2017-04-11 08:44:54.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "America/New_York" }
2017-04-11 08:44:54.000000
So you see the property date exists even for the object. I can't understand this behaviour. Just comment out the var_Dump and you will get the error again.