1.时间格式为String类型(查询所有记录时间 2017-11-03<date<2017-12-03)
if (!Strings.isNullOrEmpty(startDate)) { querySql += "and do.enter_date_time >= to_date('" + startDate + "', 'yyyy-mm-dd') "; } if (!Strings.isNullOrEmpty(endDate)) { querySql += "and do.enter_date_time < trunc(to_date('" + endDate + "', 'yyyy-mm-dd')+1) "; }
trunc:http://blog.csdn.net/haiross/article/details/12837033
2.后台得到时间格式(endDate = new Date())
querySql += "and do.enter_date_time >= startDate "; querySql += "and do.enter_date_time < endDate ";