您现在的位置是:首页>技术分享>Oracle日期倍数 整除
Oracle日期倍数 整除
发布时间:2017-12-08 编辑:小付 浏览(717) 评论(0)
这几天需要做个邮件提醒功能 就是当前日期 距离表单日期 30天后邮件提醒,以后每隔30天提醒一次。
这就需要两个日期之间的天数 并且是否30的倍数了。
oracle 需要用到
mod
贴个代码,以备不时之需:
String sql = " select prj.*,cust.FULLNAME as custFullName from Prj_Project prj "
+ "left join CRM_CUSTOMER cust on prj.fk_customerid=cust.id "
+ "where prj.id in ("
+ "select t.fk_projectid from prj_wall t where t.state=? and t.inenddate is not null "
+ "and mod((to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd')-
to_date(to_char(t.inenddate,'yyyy-mm-dd'),'yyyy-mm-dd')),30)=0 "
+ ") ";
List<PrjProject> projList = findByList(sql, PrjProject.class, PrjWall.STATE.IN);关键字词:Oracle,mod,整除,倍数,隔天