3v4l.org

run code in 300+ PHP versions simultaneously
<?php $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;

preferences:
38.88 ms | 402 KiB | 5 Q