【发布时间】:2013-11-12 22:49:44
【问题描述】:
我已经搜索了很长时间,但找不到答案。 我的问题很简单……
如何使用java将今天的日期插入到日期格式的sql数据库中? 这是代码。 (时间和日期现在为空,我如何让他们得到现在的时间和今天的日期)
String timeNow = null;
DateFormat dateNow = null;
String sql = "INSERT INTO fys.`luggage` (customer_id, description, location, date, time, is_lost, is_handled) VALUES ('"
+ customerId + "', '" + description + "', '" + location + "', '"
+ dateNow + "', '" + timeNow + "', '" + isLost
+ "', '" + isHandled + "')";
db.insertQuery(sql);
}
【问题讨论】: