oci_fetch_array() with DATE columns

怼烎@ 2023-10-18 21:15 79阅读 0赞

<?php $conn = oci_connect('hr', 'welcome', 'localhost/XE'); if (!$conn) { $e = oci_error(); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } // Set the date format for this connection. // For performance reasons, consider changing the format // in a trigger or with environment variables instead $stid = oci_parse($conn, "ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'"); oci_execute($stid); $stid = oci_parse($conn, 'SELECT hire_date FROM employees WHERE employee_id = 188'); oci_execute($stid); $row = oci_fetch_array($stid, OCI_ASSOC); echo $row['HIRE_DATE'] . "<br>\n"; // prints 1997-06-14 oci_free_statement($stid); oci_close($conn); ?>

发表评论

表情:
评论列表 (有 0 条评论,79人围观)

还没有评论,来说两句吧...

相关阅读