The PHP DateTime object is quite flexible.
Since the user has requested more than one time zone parameter, you can make it general.
General function
function convertDateFromTimezone($date,$timezone,$timezone_to,$format){ $date = new DateTime($date,new DateTimeZone($timezone)); $date->setTimezone( new DateTimeZone($timezone_to) ); return $date->format($format); }
Application:
echo convertDateFromTimezone('2011-04-21 13:14','UTC','America/New_York','Ymd H:i:s');
Output:
2011-04-21 09:14:00
Miguel 01 Oct '15 at 10:08 2015-10-01 10:08
source share