Hi,
I'm trying to write the current date into a database as a string and then read it back. The part where the date is written is fairly obvious. But I'm writing it here nevertheless.
fund.setDateOfBuying(new Date().toString());
followed by an insert query.
Following is the part where the date is read.
fundRet.setDateOfBuying(DateFormat.getInstance().parse((rs.getString(6).trim())));
And here, I get the following exception.
java.sql.SQLException: Unparseable date: "Wed Jan 10 00:10:00 GMT+05:30 2001"
How do I construct a Date object from the equivalent String ? (since the Date constructor that accepts String as parameter is deprecated)
Thanks!
Neha.