I want to get current time of US/Eastern timezone. How would I achieve that.
I have tried following code but it is displaying my system\'s time.
<         
        $amNY = new DateTime('America/New_York');
$estTime = $amNY->format('h:i:s:u');
or if you are using php 5.4 and above
estTime = (new DateTime('America/New_York'))->format('h:i:s:u');
date_default_timezone_set() will affect the whole script and should be used carefully
I just use
<?php
Date_default_timezone('est');
$lv=date('l, F jS, Y, g:I:s A T,$ir['laston']);
?>
<b>last visit</b> <em>$lv.</em>
Seems to work perfectly for me on my game that I'm working on. Mind you if you want to use it just remove the $ir['laston'] and it should work no problem
The easiest way is probably to use gmmktime() to get the Unix timestamp for the current GMT, then subtract 5 hours from it.  That way you get Eastern Time no matter where the server happens to be.
<?php
   echo date_default_timezone_get();
   $currenttime = date('h:i:s:u');
   list($hrs,$mins,$secs,$msecs) = split(':',$currenttime);
   echo " => $hrs:$mins:$secs\n";
   date_default_timezone_set('US/Eastern');
   echo date_default_timezone_get();
   $currenttime = date('h:i:s:u');
   list($hrs,$mins,$secs,$msecs) = split(':',$currenttime);
   echo " => $hrs:$mins:$secs\n";
   date_default_timezone_set('America/New_York');
   echo date_default_timezone_get();
   $currenttime = date('h:i:s:u');
   list($hrs,$mins,$secs,$msecs) = split(':',$currenttime);
   echo " => $hrs:$mins:$secs\n";
?>
Seems to work here (in Berlin):
Europe/Berlin => 01:42:42
US/Eastern => 07:45:18
America/New_York => 07:45:18
http://www.php.net/manual/en/timezones.php
Looks like the US/Eastern is deprecated. Try America/New_York
EDIT this probably won't fix your problem, but you should do it anyway. Being deprecated means that they could remove it in the future.