Time differences for time() - one hour ahead

Status
Not open for further replies.

Tarzan

New Member
Messages
66
Reaction score
0
Points
0
I've read about this issue in old threads but didn't find any answers. I also found a new twist to it: the "time()" functions only gives you one hour ahead if in the public_html folder!

I used the command "date("Y-m-d H:i:s O I T Z", time())" where
I = Daylight savingstime or not
T = Timezone
Z = Time offset in seconds

First, I let it run as a cron job in the home/<user>/etc folder and got the result
2010-10-06 14:42:01 -0400 1 EDT -14400
this looks fine.

I then ran the command as a public script on my homepage and got
2010-10-06 15:47:21 -0400 1 EDT -14400
which is one hour early!

I also printed the time stamps so the difference is the result from the "time()" not "date()"

Of course I can code around this, but if this is known to the staff I would be interested to know about its cause. (I'm on starka by the way if that matters)
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
It has to do with Apache's settings. PHP is probably set at -5 GMT (EST), and Apache at -4GMT (EDT).
 
Last edited:

Tarzan

New Member
Messages
66
Reaction score
0
Points
0
Ok that's plausible. If you have the time, you could always consider if you want to change it or not. It's kind of strange when you're working with it.

Anyway, I'm satisfied with the answer.
 
Status
Not open for further replies.
Top