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

How/where do you set date.timezone ?


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

[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