SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
cal.setTime(date);
Date date = new Date();
Calendar cal = Calendar.getInstance();cal.setTime(date);
cal.add(Calendar.MONTH, -1); //当前月的上个月 (-1改为1的话,为取当前月 的下个月)
System.out.println("***********"+cal.getTime());
输出结果:
========201412
*************Tue Dec 30 15:42:05 CST 2014