Question

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);
    } 
Was it helpful?

Solution

You probably have error here:

date.getdate()

It should be capital D

date.getDate()

OTHER TIPS

try this with JCalendar 1.4 ---------------------------------((JTextField)jDateChooser1.getDateEditor().getUiComponent()).getText()

Try this for latest version.

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String date = sdf.format(jDateChooser1.getSelectedDate().getTime());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top