Date date = new Date();//获取当前时间
Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.MONTH, -1);//当前时间前去一个月,即一个月前的时间 SimpleDateFormat dd=new SimpleDateFormat("yyyy-MM-dd"); String d=dd.format(calendar.getTime());// System.out.println(d); String dAdd = d.substring(0, 4)+d.substring(5, 7)+d.substring(8, 10); int timeInt = Integer.parseInt(dAdd);//// System.out.println(timeInt);//20181101