ID:               44380
 User updated by:  tessone at polyglut dot net
 Reported By:      tessone at polyglut dot net
-Status:           Feedback
+Status:           Open
 Bug Type:         Date/time related
 Operating System: CentOS
 PHP Version:      5.2.5
 New Comment:

As you can see from the sample code above, I haven't set date.timezone.
 If I do set it, the erratic behavior stops.

However, it is a bug that without setting the timezone explicitly, the
behavior is erratic and unpredictable.  It should default to either UTC
or the system timezone, but it definitely should not alternate randomly
between the two.


Previous Comments:
------------------------------------------------------------------------

[2008-03-13 12:08:05] [EMAIL PROTECTED]

How/where do you set date.timezone ?

------------------------------------------------------------------------

[2008-03-09 00:33:27] tessone at polyglut dot net

Description:
------------
When using localtime() to get the server time into an array, sometimes
PHP chooses the local timezone, sometimes it chooses GMT.  I am in
US/Eastern (-0500), so after 7pm, sometimes my script says it's today,
sometimes tomorrow (because it is choosing GMT).

Below is some code, plus a result from when it chooses the local
timezone (correct) and one where it chooses GMT (incorrect).

If I run date at the command-line, it consistently returns a US/Eastern
time, so the server is not skipping back and forth between timezones for
any reason.

Reproduce code:
---------------
print time() . ": ";

$serverTime = localtime(time());
print_r($serverTime);

print date("O");


Expected result:
----------------
1205022657: Array ( [0] => 57 [1] => 30 [2] => 19 [3] => 8 [4] => 2 [5]
=> 108 [6] => 6 [7] => 67 [8] => 0 ) -0500

Actual result:
--------------
1205022665: Array ( [0] => 5 [1] => 31 [2] => 0 [3] => 9 [4] => 2 [5]
=> 108 [6] => 0 [7] => 68 [8] => 0 ) +0000


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44380&edit=1

Reply via email to