mhewall Posted May 20, 2007 Share Posted May 20, 2007 My webserver is hosted in England and I'm in the US. So all the time is showing up a couple hours ahead of my timezone. I can't edit the php.ini file or none of that so I was wondering how would I go about changing the php scripts on my pages to display the time and date as EST. At 11 PM my time Saturday may 19 it said it was "Sunday May 20, 4:00 am" So I can't just do something that changes that hour, I need it to display the correct date aswell. I need it to be the Date and Time in New York (5 hour difference) So if anyone can help me I would really appricate at. Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/52232-show-time-in-different-timezone/ Share on other sites More sharing options...
MadTechie Posted May 20, 2007 Share Posted May 20, 2007 just +5 hours on the output! Quote Link to comment https://forums.phpfreaks.com/topic/52232-show-time-in-different-timezone/#findComment-257673 Share on other sites More sharing options...
chigley Posted May 20, 2007 Share Posted May 20, 2007 <?php ini_set("date.timezone", "America/New_York"); // Rest of code here ?> A list of other timezones can be found at http://www.php.net/manual/en/timezones.php Quote Link to comment https://forums.phpfreaks.com/topic/52232-show-time-in-different-timezone/#findComment-257674 Share on other sites More sharing options...
mhewall Posted May 20, 2007 Author Share Posted May 20, 2007 just +5 hours on the output! How would I do that? This is the code that is showing the date/time echo date("l F j, Y, h:i:s A"); <?php ini_set("date.timezone", "America/New_York"); // Rest of code here ?> A list of other timezones can be found at http://www.php.net/manual/en/timezones.php I tired that, it did not work. Quote Link to comment https://forums.phpfreaks.com/topic/52232-show-time-in-different-timezone/#findComment-257698 Share on other sites More sharing options...
MadTechie Posted May 20, 2007 Share Posted May 20, 2007 try <?php echo date("l F j, Y, h:i:s A"); echo "<br />"; echo date("l F j, Y, h:i:s A", (time()+ 5 * 60 * 60)) ; ?> Quote Link to comment https://forums.phpfreaks.com/topic/52232-show-time-in-different-timezone/#findComment-257716 Share on other sites More sharing options...
chigley Posted May 20, 2007 Share Posted May 20, 2007 How didn't it work? Should work. :S Quote Link to comment https://forums.phpfreaks.com/topic/52232-show-time-in-different-timezone/#findComment-257831 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.