0
ps.setString(26, ((JTextField) Birthday.getDateEditor().getUiComponent()).getText());

那是我的代码,我如何将日期格式转换为 MMM d, yyyy,因为我的 JDateChooser 的默认格式是 yyyy-MM-dd。

4

1 回答 1

0

试试这个:

DateFormat f = new SimpleDateFormat("MMM d, yyyy");
ps.setString(26, f.format(((JTextField) Birthday.getDateEditor().getUiComponent()).getText()));

更正

DateFormat f = new SimpleDateFormat("MMM d, yyyy");
ps.setString(26, f.format(Birthday.getDate()));
于 2015-04-15T06:22:16.117 回答