日期类型的字段的查询

当指定的某个查询字段为date类型时,要对其进行转换

如:查询2011-11-1的记录

String pubdate1="2011-11-1";

String oracleDatePattern = "yyyy-MM-dd HH24:mi:ss";  
   sqlString= " and Z.pubDate between to_date('" + pubdate1+ " 00:00:00" + "','"
       + oracleDatePattern + "') and to_date('"+pubdate1+" 23:59:59"+"','"+oracleDatePattern+"')";
   

猜你喜欢

转载自helloworlda.iteye.com/blog/1229634