Click here to Skip to main content
15,168,105 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to save today's date from C# to oracle for the following format:

02/26/2013 05:58:50 PM

Could you please send me the code for C#
Posted
Updated 6-Apr-19 10:42am

Just pass it as a DateTime using Oracle Parameter.AddWithValue[^] - you should not convert datatypes unnecessarily, so if the target accepts DateTime values (and all DB's do) then it is pointless converting it and introducing the possibility of errors due to incompatible formats.
   
Hello friend,

in C# you need to cast your date using this format same as you required

C#
DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss tt")



and while using oracle you need to cast it back to your Date, you can use this format in oracle

SQL
SELECT TO_CHAR(sysdate,'MM/dd/yyyy hh:mi:ss AM') from dual
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900