Reputation: 9
i am making a inventory system in php using oracle database. there is a page where admin clik on "sold" button date and time along with other data will store in oracle database, i can enter date but when enter time an error show in screen "Warning: oci_execute(): ORA-01843: not a valid month " my code is given below. please help...
<?php
$c = oci_connect('STOCK_SYS', 'passward', 'db');
$date1 = date('d-M-y');
$time1 =date('h-i-s');
$orclq = "INSERT INTO STOCK_TABLE(SALE_DATE,SALE_TIME) VALUES (:date1,:time1)";
$compiled = oci_parse($c, $orclq);
oci_bind_by_name($compiled, ':date1', $date1);
oci_bind_by_name($compiled, ':time1', $time1);
?>
regards...
Upvotes: 0
Views: 1451
Reputation: 913
You may need to check the NLS_DATE_FORMAT settings for your database
SELECT value
FROM nls_session_parameters
WHERE parameter = 'NLS_DATE_FORMAT'
here's how you can change this setting for your session:
alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
Upvotes: 1