-1

I used http://toedter.com/ jDateChooser to get the date from user. But now I want to reset the selected date to the calendar from SQL database. This is the code I wrote to put selected date to database.

pst.setString(5, ((JTextField)datead.getDateEditor().getUiComponent()).getText());
Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
nascar895
  • 149
  • 1
  • 12

1 Answers1

-1

I figured it out myself.

java.util.Date dateadx = new SimpleDateFormat("yyyy-MM-dd").parse(dateadm);

Here dateadm is the String variable which you want to store as date in JDateChooser.

Then you can simply call

datead.setDate(dateadx)

to set the date.

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
nascar895
  • 149
  • 1
  • 12