Why can’t I access DateTime->date in PHP’s DateTime class?

This is a known issue.

Date being available is actually a side-effect of support for var_dump() here – derick@php.net

For some reason, you’re not supposed to be able to access the property but var_dump shows it anyways. If you really want to get the date in that format, use the DateTime::format() function.

echo $mydate->format('Y-m-d H:i:s');

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)