I'm trying to insert a row in oracle database and when i try with the date i have the errore in title.
My date is DD/MM/YYYY HH:MM:SS (example 25/01/2013 12:07:19)
edit for better explain:
i have an android application and want to insert a row in oracle database by php.
in Php i have:
$sqlString = sprintf("INSERT INTO GUASTI (%s, %s, %s, %s, %s, %s)
VALUES ('%s', '%s', '%s', '%s', '%s', '%s')"
,'guasto','tipo','data', 'localita', 'indirizzo_id', 'utente_id',
$array['guasto'], $array['tipo'], $array['data'], $array['localita'], $idUtenti, $idIndirizzo);
where $array['data'] is 25/01/2013 12:07:19
p.s. i know that there are security problems there but it is not a problem for now.
MM is for month. Use MI for minutes.
You have
HH:MM:SS
every time where the minutes are greater than 12 will trigger the error as you are telling Oracle to interpret them as months.
You are also using HH without am/pm (in your example you just used 12). If you are using a 24 format use HH24
DD/MM/YYYY HH24:MI:SS
or if you want the 12-hour format
DD/MM/YYYY HH:MI:SSAM
and then
02/01/2013 07:42:00am
Edit
You are inserting the date with the default format which is MM/DD/YYYY (american standard): 25 is not a valid month. You can use the TO_DATE function
'TO_DATE(' . $array['data'] . ', DD/MM/YYYY HH24:MI:SS)'
Use TO_DATE('20/08/2012 09:00:00','DD/MM/YYYY HH24:MI:SS') while inserting date for more details see link Oracle Error
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With