JAVA 取上个月
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");Calendar calendar = Calendar.getInstance();Date curDate = java.sql.Date.valueOf("2012-12-22");calendar.setTime(curDate);//取得现在时间System.out.println(sdf.format(curDate));//取得上一个时间calendar.set(Calendar.MONDAY, calendar.get(Calendar.MONDAY) - 1);//取得上一个月的下一天calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) + 1);System.out.println(sdf.format(calendar.getTime()));