Page 1 of 1

Problem with time

Posted: Thu Aug 05, 2004 4:54 am
by accu
Hi all,

I'm expirincing a problem whith time.

With date command, using a Linux shell, i obtain this result

The Aug 5 11:42:42 CEST 2004

while with this php script, on the same server,

$today = getdate();
$month = $today['month'];
$mday = $today['mday'];
$year = $today['year '];
$hour = $today['hour '];
echo "$month $mday, $year $hour";

I obtain

August 5, 2004 05:42:42

a difference of about 6 hours.

please, can someone suggest what' wrong?

Thank's in advance.
Accursio Avona. [/b]

Posted: Thu Aug 05, 2004 5:26 am
by markl999
Out of interest, what does this output?

Code: Select all

echo date('F j, Y h:i:s');

Posted: Thu Aug 05, 2004 5:40 am
by accu
Is Exactly the same

six hour of difference.

Posted: Thu Aug 05, 2004 6:05 am
by markl999
And this is all you have in the script? i.e there's no code anywhere that's setting the timezone?
(and i'm presuming that the date/time from PHP is wrong, not the date/time from the shell?)

Posted: Thu Aug 05, 2004 8:14 am
by accu
I solved.

I set the environment variable TZ to the rigth TimeZone and everything seems to work fine.

Tanks for your interest
Accursio Avona