首页 > sql判断当前时间和数据库时间差

sql判断当前时间和数据库时间差

String queryString = "SELECT c.couponname,c.couponfee/100,c.pic1_path,date_format(c.endtime,'%Y-%c-%d') as endTime FROM couponpublish c,couponpool s WHERE s.pubid=c.pubid AND s.owner='"+userId+"' ";
            String whereString="";
            //优惠卷类别  1.可用;2.历史
            if(type==1){
                whereString=whereString+" and ( '"+nowTime+"' between c.starttime and c.endtime ) and  s.status=3 ";
            }else{
                whereString=whereString+" and (( '"+nowTime+"' > c.endtime ) or s.status>3  )";
            }
            
            String orderString=" order by c.updatetime ";
         
            int offset=PagerUtil.getOffset(Integer.valueOf(page),Integer.valueOf(rows));
            List<Map> list=super.findListbySqlReturnMapByPage(queryString+whereString, offset, Integer.valueOf(rows));
            
             System.out.println(list);        
            attributes.put("coupons", list);
            
        }else{
            throw new InterfaceException(new ErrorBean(ErrorCode.USER_NO_LOGIN));
        }
        
        return  attributes;
        
        我要判断当前时间和查到的时间是不是差3天 并存到list里 
        作为后台接口 
        
        
        
【热门文章】
【热门文章】