$placename=timezone_name_from_abbr("", $timezone * 3600, false);
$date = date_create($list['stamp'], timezone_open($placename));
$datetimezone=new DateTimeZone('Europe/London');
$dateTime = new DateTime($list['stamp'],$datetimezone);
$dateTime->setTimeZone(new DateTimeZone($placename));
change
I tried the following code suggested as an answer, and it produced a time that was 2 hours less than it should have been. I checked my db and the time in DB is GMT. so the problem is to convert it from GMT using conversion
$timezone=-4
the user code answers, below it gives a time equal to two hours. converts from GMT to America / New _York, but it's two hours slower. I checked the placename variable to make sure it is America / New_York. what could be the reason for this?
$placename=timezone_name_from_abbr("", $timezone * 3600, true);
$dateTime = new DateTime($list['stamp']);
$dateTime->setTimeZone(new DateTimeZone($placename));
echo $dateTime->format('F d g:i a');
original question
, America/New_York, UTC, , , ? db 2012-05-13 07:30:47
$placename=timezone_name_from_abbr("", $timezone * 3600, true);
$date = date_create($list['stamp'], timezone_open($placename));
echo date_format($date, 'F d g:i a');