chenrui
2025-05-20 96eecc97de7fc863fc76b63294d4c12bd9683ae4
src/main/java/com/ruoyi/common/utils/DateUtils.java
@@ -145,16 +145,20 @@
    }
    /**
     * 计算两个时间差
     * 计算时间差
     *
     * @param endDate 最后时间
     * @param startTime 开始时间
     * @return 时间差(天/小时/分钟)
     */
    public static String getDatePoor(Date endDate, Date nowDate)
    public static String timeDistance(Date endDate, Date startTime)
    {
        long nd = 1000 * 24 * 60 * 60;
        long nh = 1000 * 60 * 60;
        long nm = 1000 * 60;
        // long ns = 1000;
        // 获得两个时间的毫秒时间差异
        long diff = endDate.getTime() - nowDate.getTime();
        long diff = endDate.getTime() - startTime.getTime();
        // 计算差多少天
        long day = diff / nd;
        // 计算差多少小时