#45285 [NEW]: DateTime() doesn't get zone from ini
| From: | davidn at virtuant dot com | Date: | Mon, 16 Jun 2008 18:39:23 +0000 |
| Subject: | #45285 [NEW]: DateTime() doesn't get zone from ini | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-125813@lists.php.net to get a copy of this message | ||
From: davidn at virtuant dot com
Operating system: Win Vista, Win 2003Server
PHP version: 5.2.6
PHP Bug Type: Date/time related
Bug description: DateTime() doesn't get zone from ini
Description:
------------
My php.ini:
[Date]
; Defines the default timezone used by the date functions
date.timezone = "America/New_York"
When using the new DateTime() function: without explicitly setting the
actual timezone in code, no timezone is recognized.
Also, when using date_default_timezone_set(), you can't depend on
date_default_timezone_get() to get the .ini setting. It doesn't work.
Reproduce code:
---------------
date_default_timezone_set(date_default_timezone_get());
$datetime = new DateTime();
$datetime->format('G'), 0, 0); // top of hour
echo $datetime->format(DATE_RFC3339);
Expected result:
----------------
2008-06-16T18:00:00+01:00
Actual result:
--------------
2008-06-16T18:00:00+00:00
--
Edit bug report at http://bugs.php.net/?id=45285&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45285&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45285&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45285&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45285&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=45285&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45285&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45285&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45285&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45285&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45285&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=45285&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=45285&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45285&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45285&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45285&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45285&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45285&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45285&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45285&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45285&r=mysqlcfg