0

I am actually trying to populate a jdatechooser with the date fetched from oracle database. The date is stored as 11-JUL-1995 in the database. But when I try to fetch it from the database using the following code, the error is shown as:- java.text.ParseException: Unparseable date: "11-Jul-1995". Please tell me what am i doing wrong?? Code:-

String dob=rs1.getString("DOB");
Date date = new SimpleDateFormat("dd-mmm-yyyy").parse(dob);  //SETTING DATE FROM DATABASE INTO DATECHOOSER
dc.setDate(date);

Here, dc is the jdatechooser and String dob is the date retrieved from the database.

Swapnil Sahu
  • 23
  • 2
  • 9

1 Answers1

0

should be dd-MMM-yyyy. m refers to minutes. Always refer to javadoc for more information

Date date = new SimpleDateFormat("dd-MMM-yyyy").parse(dob);

sidgate
  • 14,650
  • 11
  • 68
  • 119