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;
}
    原文作者:生活如水
    原文地址: https://blog.csdn.net/qq_37511501/article/details/80193134
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞