I'm having an issue while trying to insert a date into an SQL server using Java:
//final String input = "20120823151034";
final String input = "06282013143533";
final DateFormat df = new SimpleDateFormat("MMddyyyyHHmmss");
final Calendar c = Calendar.getInstance();
c.setTime(df.parse(input));
//c.add(Calendar.MILLISECOND, 1);
String s=df.format(c.getTime());
java.util.Date parsedUtilDate = df.parse(s);
java.sql.Date sqltDate= new java.sql.Date(parsedUtilDate.getTime());
System.out.println(sqltDate);
Here, I'm expecting the complete string being output as the year, month, day, hour, minutes, and seconds to be inserted into SQL server, but I'm only getting the year, month, and the date. What should I do to insert the date and the time into the database?