Convert Unix Timestamp to time zone?
Use DateTime and DateTimeZone:
$dt = new DateTime('@1369490592');
$dt->setTimeZone(new DateTimeZone('America/Chicago'));
echo $dt->format('F j, Y, g:i a');
An easier way to do that is:
While using gmdate()
, add your time zone in seconds to unix_stamp in gmdate.
Consider my time zone is GMT+5:30. So 5 hr 30 min in seconds will be 19800
So, I'll do this:gmdate("F j, Y, g:i a", 1369490592+19800)