Reputation: 1
I want to save date ie.current date in oracle DB in MM/dd/yyyy format.
My oracle db has column , which has data type as date.
can anybody let me know how I can do this. I tried like,
java.text.DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
String s = df.format(new Date()); // It is giving in String format
But How I can set it to my oracle DB column ?
Upvotes: 0
Views: 598
Reputation: 5919
Just save the date without any formatting.
update table set column=sysdate where id=1
While reading back the data, use
select to_char(column, 'MM/DD/YYYY') my_date from table
Upvotes: 1