Jump to content

Server returns time from different timezone


rrgriola

Recommended Posts

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.

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.