Date in UiPath and Oracle

Hi,
Am trying to insert a query containing current date and time in it. But it shows up an error as:
RemoteException wrapping System.Data.OracleClient.OracleException: ORA-01849: hour must be between 1 and 12

My Assign has : sysdate = System.DateTime.Now.ToString
Insertion query is as follows :

"insert into table_name(col1,col2,col3,col4,col5,create_date,created_by) values(00,0,'"+var1+"','"+system.Environment.UserName+ "','New',TO_DATE(sysdate,'HH12:MI:SS'),'" +system.Environment.MachineName+"')"

What wrong am i doing??

1 Like

@hss

In Error decription it is clear it support 12hr not 24 hr
System.DateTime.Now.ToString will return 09/27/2019 16:34:31

Try This System.DateTime.Now.ToString(“MM/dd/yyyy hh:mm:ss”)

Thanks,
Suresh J

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.