Jdatechooser getDate()方法不起作用

时间:2013-09-18 05:20:23

标签: java jdatechooser

我正试图从jDateChooser获取约会。所以我使用了这个更新查询。但是现在我将此getDate()方法视为cannot find the symbol错误。我正在使用JDBC类。以下是我的询问:

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);
    } 

3 个答案:

答案 0 :(得分:2)

你这里可能有错误:

date.getdate()

应为大写D

date.getDate()

答案 1 :(得分:2)

尝试使用JCalendar 1.4 --------------------------------- ((JTextField)jDateChooser1.getDateEditor().getUiComponent()).getText()

答案 2 :(得分:1)

试试最新版本。

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String date = sdf.format(jDateChooser1.getSelectedDate().getTime());