wuxw
2022-10-27 a24b7249257a8eb23f610f9fce3f540c880e5d54
java110-utils/src/main/java/com/java110/utils/util/DateUtil.java
@@ -174,6 +174,8 @@
        return getFormatTimeString(new Date(), pattern);
    }
    public static String getLastTime() {
        return LAST_TIME;
    }
@@ -447,7 +449,7 @@
        System.out.println( "2021-12-07".compareTo(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_B)));
    }
    public static String getAddDayString(Date date,String pattern,int days) throws ParseException {
    public static String getAddDayString(Date date,String pattern,int days)  {
        SimpleDateFormat sf = new SimpleDateFormat(pattern);
        Calendar c = Calendar.getInstance();
        c.setTime(date);
@@ -455,6 +457,31 @@
        return sf.format(c.getTime());
    }
    public static String getAddDayStringB(Date date,int days) {
        SimpleDateFormat sf = new SimpleDateFormat(DATE_FORMATE_STRING_B);
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        c.add(Calendar.DAY_OF_MONTH, days);
        return sf.format(c.getTime());
    }
    public static String getAddDayStringA(Date date,int days) {
        SimpleDateFormat sf = new SimpleDateFormat(DATE_FORMATE_STRING_A);
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        c.add(Calendar.DAY_OF_MONTH, days);
        return sf.format(c.getTime());
    }
    public static String getAddMonthStringA(Date date,int month) {
        SimpleDateFormat sf = new SimpleDateFormat(DATE_FORMATE_STRING_A);
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        c.add(Calendar.MONTH, month);
        return sf.format(c.getTime());
    }
    /**
     * 在给定的日期加上或减去指定月份后的日期
     *