Java 计算加几个月之后的时间

public static String addMonth(String date,String dateType,int month){
    String nowDate = null;
    SimpleDateFormat format = new SimpleDateFormat(dateType);
    try {
        Date parse = format.parse(date);
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(parse);
        calendar.add(Calendar.MONTH, month);
        nowDate = format.format(calendar.getTime());
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return nowDate;
}

你可能感兴趣的:(Java,Date)