ID: 42166 Updated by: [EMAIL PROTECTED] Reported By: sven dot goldt dot extern at hvb dot de -Status: Open +Status: Bogus Bug Type: Oracle related Operating System: Windows XP PHP Version: 5.2.3 Assigned To: sixd New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php ---------------------------------------- The default format of date strings returned to PHP depends on Oracle settings. Other tools like SQL*Plus will also have the same display format you see. You can change the default format by one or all of: (i) setting environment variables like NLS_LANG or NLS_DATE_FORMAT in the shell that starts the web server or PHP process (ii) Executing a command like "alter session set nls_date_format='DD.MM.YYYY HH24:MI:SS'" soon after connecting in PHP (iii) Using to_char() in each query ---------------------------------------- Previous Comments: ------------------------------------------------------------------------ [2007-08-01 11:54:43] sven dot goldt dot extern at hvb dot de Description: ------------ When you want to select a column from a table whose type is "DATE" then php truncates the value so that you only get the day but not the time from it that mean no hours, no minutes and no seconds. Reproduce code: --------------- $query="select datefield from sometable"; $conn = oci_connect("user", "pass", "//dbserver:1521/HVSQP0"); $stmt = oci_parse($conn, $query); oci_execute($stmt); while ($result = oci_fetch_row($stmt)) { print_r($result); print "<br>\n"; } ... Expected result: ---------------- Something like 01.08.2007 13:45:28 Actual result: -------------- you get only 01.08.2007. The only workaround i found so far is to change the query to "select TO_CHAR(datefield,'DD.MM.YYYY HH24:MI:SS') from sometable". Then you get what you expect. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42166&edit=1
