rrgriola Posted June 15, 2011 Share Posted June 15, 2011 I have read many forum posts on the use of date(), time(), and $_SERVER['REQUEST_TIME']. Here is my issue. My server is set for Mountain Standard Time (MST). I can see this in the server confiq. in php.ini the timezone is set to AMERICA/Phoenix. However when I run a script with just date() the time returned is clearly Eastern time. My script is stripped down to only return that function. I keep testing different inputs, I have tried to only call the $_SERVER['REQUEST_TIME'] and I keep getting Eastern (my timezone). What am I missing? What I am trying to do: I have a script that should only display a dialogue box/input box at a certain time based on the server time, and the end of an offer time stored on my db. So I call the server time to compare to the end time on the db. The script works fine but actual time returned by date() messes it up by a couple hours. Thanks in advance for advice. Quote Link to comment https://forums.phpfreaks.com/topic/239392-server-returns-time-from-different-timezone/ Share on other sites More sharing options...
redixx Posted June 15, 2011 Share Posted June 15, 2011 What does date_default_timezone_get() return? Quote Link to comment https://forums.phpfreaks.com/topic/239392-server-returns-time-from-different-timezone/#findComment-1229874 Share on other sites More sharing options...
rrgriola Posted June 15, 2011 Author Share Posted June 15, 2011 It returns EASTERN! Why! Which makes no sense. So there is something between my server and display that is changing it. Quote Link to comment https://forums.phpfreaks.com/topic/239392-server-returns-time-from-different-timezone/#findComment-1229976 Share on other sites More sharing options...
rrgriola Posted June 15, 2011 Author Share Posted June 15, 2011 Problem Solved. I had this in my config file. I set it a long time ago and had forgotten about it. The answer is typically so simple, not sinister. Thanks for jogging my memory! date_default_timezone_set('US/Eastern'); I removed it and bam! everything is working. RG Quote Link to comment https://forums.phpfreaks.com/topic/239392-server-returns-time-from-different-timezone/#findComment-1229977 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.