I’m Trying to Convert String to Date in My Android App to Insert Data in SQL Database through jdbc. But while i tried to convert String to Date i’m Getting the Following Error.
10-29 15:34:55.404: W/Error connection(11433): java.util.Date
Here is My Sample Code Here i imported java.util.Date;
String sDate="29/10/2012 12:00:00 AM";
Date bondDate = (Date) new SimpleDateFormat("dd/MM/yyyy").parse(sDate);
CallableStatement cStmtInsertPOdetails =conn.prepareCall("{call dbo.InsertDetails(?)}");
cStmtInsertPOdetails.setDate("@POD_BondDate",(java.sql.Date)bondDate);
Please Help me To Solve this issue?
bondDatewhich isjava.util.Datecan not be cast tojava.sql.Date. Usenew java.sql.Date(bondDate.getTime())Though it will be advisable to use pattern
dd/MM/yyyy HH:mm:ss a. CheckSimpleDateFormatto understand aboutTime Pattern Syntax