启用时间+年=到期时间

1
2
3
4
5
6
7
8
9
10
11
public static String getYearAddMonth(String nowDate,Integer year) throws ParseException {
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date date = formatter.parse(nowDate);
    Calendar c = Calendar.getInstance();
    c.setTime(date);
    c.add(Calendar.YEAR, year);//加十年
    c.add(Calendar.DAY_OF_YEAR, -1);//减一天
    Date tomorrow = c.getTime();
    String disableDate = formatter.format(tomorrow);
    return disableDate;
}


ˆ Back To Top