Reputation: 69
I'm trying to get date from jDateChooser
. So I used this update query. But now I'm getting this getDate()
method as cannot find the symbol
error. I'm using JDBC class. And following is my query:
try {
new JDBC().putData("UPDATE work SET balance='"+txtValue.getText()+"', date='"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date.getdate()) +"' WHERE id='1'");
} catch (Exception e) {
JOptionPane.showMessageDialog(null, this.getClass().getName() +" "+e);
}
Upvotes: 1
Views: 7438
Reputation: 2209
Try this for latest version.
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String date = sdf.format(jDateChooser1.getSelectedDate().getTime());
Upvotes: 1
Reputation:
try this with JCalendar 1.4
---------------------------------((JTextField)jDateChooser1.getDateEditor().getUiComponent()).getText()
Upvotes: 2
Reputation: 11579
You probably have error here:
date.getdate()
It should be capital D
date.getDate()
Upvotes: 2