gple Posted December 28, 2010 Share Posted December 28, 2010 $date=date("Y-m-d H:i:s"); This is returning me the GMT time instead of EST. I get 15:26:08 as the time instead of 10:26:08. How can I get around this? Quote Link to comment Share on other sites More sharing options...
johnny86 Posted December 28, 2010 Share Posted December 28, 2010 <?php $date = new DateTime('now', new DateTimeZone('Your/Timezone')); echo $date->format('Y-m-d H:i:s') . "\n"; // Example $date = new DateTime('now', new DateTimeZone('Europe/Helsinki')); echo $date->format('Y-m-d H:i:s') . "\n"; // 2010-12-28 17:38:45 ?> Quote Link to comment Share on other sites More sharing options...
the182guy Posted December 28, 2010 Share Posted December 28, 2010 To do it script wide so that all your date() calls will be in the specified timezone use: date_default_timezone_set('EST'); Quote Link to comment Share on other sites More sharing options...
gple Posted December 28, 2010 Author Share Posted December 28, 2010 so what would i put in for new york time? DateTimeZone('America/New York')? Quote Link to comment Share on other sites More sharing options...
johnny86 Posted December 28, 2010 Share Posted December 28, 2010 http://fi.php.net/manual/en/timezones.america.php America/New_York Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.