日期:2014-05-16 浏览次数:20463 次
// 查询时,给Datetime字段传入Date类型的参数 Date startTime = new Date(...); Date endTime = new Date(...); ps = conn.prepareStatement(sql); ps.setTimestamp(1, new java.sql.Timestamp(startTime.getTime())); ps.setTimestamp(2, new java.sql.Timestamp(endTime.getTime())); // 查询后,把Datetime字段转换为Date类型 Date date; while (rs.next()) { date = new Date(rs.getTimestamp("xxx").getTime()); }