wuxw
2022-10-30 c13d7af78a1fd29169c3b4c3ae3497d5706948f5
java110-utils/src/main/java/com/java110/utils/util/DateUtil.java
@@ -175,7 +175,6 @@
    }
    public static String getLastTime() {
        return LAST_TIME;
    }
@@ -587,4 +586,25 @@
    private static int millisecondsToDays(long intervalMs) {
        return (int) (intervalMs / (1000 * 86400));
    }
    /**
     *    *字符串的日期格式的计算
     *
     */
    public static int daysBetween(String smdate, String bdate) {
        long between_days = 0;
        try {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Calendar cal = Calendar.getInstance();
            cal.setTime(sdf.parse(smdate));
            long time1 = cal.getTimeInMillis();
            cal.setTime(sdf.parse(bdate));
            long time2 = cal.getTimeInMillis();
            between_days = (time2 - time1) / (1000 * 3600 * 24);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return Integer.parseInt(String.valueOf(between_days));
    }
}