I know that in php you can create an DateTime object from a unix timestamp and set its timezone in multiple lines like the following:
$date = new DateTime('@' . $timestamp);
$date_with_timezone = $date->setTimezone(new DateTimeZone('America/Chicago'));
I would like to do this on one line however. The following does not work:
$date_with_timezone = new DateTime('@' . $timestamp, new DateTimeZone('America/Chicago'));
Is there any way to create a php DateTime object from a unix timestamp, and set a timezone on the same line?