date 日期加一天

date 日期加一天

 if(!params.get("aftercreatedate").equals("")){
            SimpleDateFormat s=new SimpleDateFormat("yyyy-MM-dd");
            Date date=new Date();
            try{
                date=s.parse((String)params.get("aftercreatedate")); //取时间
            }catch (ParseException pe){
                pe.printStackTrace();
            }
            Calendar   calendar = new GregorianCalendar();
            calendar.setTime(date);
            calendar.add(calendar.DATE,1); //把日期往后增加一天,整数  往后推,负数往前移动
            date=calendar.getTime(); //这个时间就是日期往后推一天的结果
            params.put("aftercreatedate",s.format(date));
        }

猜你喜欢

转载自blog.csdn.net/qq_40680190/article/details/82871659