import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class Du03 {
public static void main(String[] args) {
String time = "2010/12/24 16:00:00";
try {
Date date = new SimpleDateFormat("yyyy/mm/dd hh:MM:ss").parse(time);
Calendar cal= Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.DATE, -1);
Date yesterday =cal.getTime();//昨天
cal.add(Calendar.DATE, 1);
cal.add(Calendar.MONTH, -1);
Date lastMonthSameDay = cal.getTime();//上个月
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}