
HI all,
i have date comming from one text file into string filed in java code. once the date is available in filed ( of type String ) in java code, then i have to convert it into yyyy-mm-dd hh-mm-ss. then i have to insert the date into oracle DB.
my code is as below:
String DATEADDED = tokens[8]; .... (the date from source into local java filed)
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); DATEADDED1 = formatter.parse(DATEADDED);
int k=st.executeUpdate("insert into REQUISITIONS values ( '"+FOLDERID+"','"+LANGUAGE+"',"+ "{ts'"+formatter.format(DATEADDED1)+"'});
when date filed DATEADDED is blank, I am getting the error as java.text.ParseException: Unparseable date: "" at java.text.DateFormat.parse(Unknown Source) at test7.main(test7.java:106)
but it is working fine when date filed is not blank.
can any boady help me.
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.