hql 查询今日记录

Date today = new Date();
Date tomorrow = new Date();
		 
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
		 
String dateStr = sdf.format(today) ;
try {
	today = sdf2.parse(dateStr+ " 00:00:00");
	tomorrow = sdf2.parse(dateStr+ " 23:59:59");
} catch (ParseException e) {
	e.printStackTrace();
}
	        
whereBuffer.append(" and createTime >= ?");
params.add(today);
		 
whereBuffer.append(" and createTime <= ?");
params.add(tomorrow);     

你可能感兴趣的:(数据库)