‘liusuyi’
2023-09-28 33aed56cfbaad870dbf4780688ba6b08d0ee806c
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java
@@ -1,6 +1,7 @@
package com.ruoyi.common.utils;
import java.lang.management.ManagementFactory;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
@@ -84,6 +85,19 @@
        }
    }
    public static final Date covertTime(Date date)  {
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Timestamp now = new Timestamp(date.getTime());
        String str = df.format(now);
        Date newDate = null;
        try {
            newDate = df.parse(str);
        } catch (ParseException e) {
            throw new RuntimeException("转换日期去掉毫秒异常");
        }
        return newDate;
    }
    /**
     * 日期路径 即年/月/日 如2018/08/08
     */