Convert Unix Timestamp to time zone?
As because edit queue for John Conde's answer is full I'll add more detailed answer.
From DateTime::__construct(string $time, DateTimeZone $timezone)
The $timezone parameter and the current timezone are ignored when the $time parameter either is a UNIX timestamp (e.g. @946684800)…
This is the main reason why you should always specify timezone, even default, when creating DateTime
objects from unix timestamp. See explained code inspired by John Conde's answer:
$dt = new DateTime('@1369490592');// use your default timezone to work correctly with unix timestamps// and in line with other parts of your applicationdate_default_timezone_set ('America/Chicago'); // somewhere on bootstrapping time…$dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));// set timezone to convert time to the other timezone$dt->setTimeZone(new DateTimeZone('America/Chicago'));echo $dt->format('F j, Y, g:i a');