#45285 [Opn->Fbk]: DateTime() doesn't get zone from ini

From: Date: Mon, 16 Jun 2008 21:56:14 +0000
Subject: #45285 [Opn->Fbk]: DateTime() doesn't get zone from ini
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-125817@lists.php.net to get a copy of this message
ID: 45285 Updated by: derick@php.net Reported By: davidn at virtuant dot com -Status: Open +Status: Feedback Bug Type: Date/time related Operating System: Win Vista, Win 2003Server PHP Version: 5.2.6 New Comment: Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. Your reproducible code is broken, please provide working code. Previous Comments: ------------------------------------------------------------------------ [2008-06-16 18:39:22] davidn at virtuant dot com 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 this bug report at http://bugs.php.net/?id=45285&edit=1

« previous php.bugs (#125817) next »