Now i am able to fetch the records but i am not able to set the date field in database.
In excel sheet the date is in date field format. So how can i fetch the date field from excel sheets.
This is what i have done
And this is what i get output for printing strdate
The error shows that i am not able to parse the date.
So what should i do in this case.
From the exception we can see that "06 05 2011 12:00:00" is the string you are trying to format and which is not yyyy-mm-dd. You can use something like this
# java.text.ParseException: Unparseable date: "06 05 2011 12:00:00"
# at java.text.DateFormat.parse(DateFormat.java:337)
# at summerinterndates.Main.contentReading(Main.java:143)
# at summerinterndates.Main.init(Main.java:51)
# at summerinterndates.Main.main(Main.java:290)
and you will get "2010-05-06" as output
What i have done is format the date field in excel sheet as a text field. I was successfully able to get the date in format i wanted.
But now there is an other problem which i am facing right now.
the line which is marked bold, i am getting an error there. Where my netbeans specify me to do "stmt.setDate(1, (java.sql.Date) startdate);" but again in gives an exception while updating the table that "Error: java.util.Date cannot be cast to java.sql.Date" so what should be done in this case.