If I un comment print_r($dateTime)
then this statement working fine echo $dateTime->date;
Why this is happening . Give me suggestions please.
$current_date=date('Y-m-d H:i:s');
$dateTime = DateTime::createFromFormat("Y-m-d H:i:s", $current_date, (new DateTimeZone('UTC')));
$dateTime->setTimezone(new DateTimeZone('PST'));
//print_r($dateTime); //If I print object then below echo stmt is working
echo $dateTime->date;
Getting Following Error
Notice: Undefined property: DateTime::$date in C:\xampp\htdocs\datetime.php