Pregunta

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);
    } 
¿Fue útil?

Solución

You probably have error here:

date.getdate()

It should be capital D

date.getDate()

Otros consejos

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());
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top