Java如何查询sql时间为time的某一列数据? 5
Stringsql="SELECT*FROM"+sheet;ResultSetrs=st.executeQuery(sql);rs.next();Stringtime=r...
String sql = "SELECT * FROM " + sheet;
ResultSet rs=st.executeQuery(sql);
rs.next();
String time=rs.getString(4);
得到的时间加五分钟后查询
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
java.util.Date myDate=format.parse(time);
Calendar calendar = Calendar.getInstance();
calendar.setTime(myDate);
calendar.add(Calendar.MINUTE,5);
myDate = calendar.getTime();
查询五分钟后时间列。
String sql_w=" select * from " + sheet + " where DTCOLLECTTIME = " + myDate
结果抛出异常,应该是myDate数据类型不对,各位大神求解 展开
ResultSet rs=st.executeQuery(sql);
rs.next();
String time=rs.getString(4);
得到的时间加五分钟后查询
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
java.util.Date myDate=format.parse(time);
Calendar calendar = Calendar.getInstance();
calendar.setTime(myDate);
calendar.add(Calendar.MINUTE,5);
myDate = calendar.getTime();
查询五分钟后时间列。
String sql_w=" select * from " + sheet + " where DTCOLLECTTIME = " + myDate
结果抛出异常,应该是myDate数据类型不对,各位大神求解 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询