jiangping
2024-05-20 8c79ff2c695254275669390dc4353593b42b7475
server/system_service/src/main/java/com/doumee/core/utils/DateUtil.java
@@ -1876,11 +1876,10 @@
    }
    public static int compareDate(String format, String str1, Date date2) {
        Date date1 = null;
        try {
            date1 = fromStringToDate(format, str1);
        } catch (ParseException e) {
        } catch (Exception e) {
            // TODO 自动生成 catch 块
            e.printStackTrace();
        }
@@ -2403,6 +2402,16 @@
            return new Timestamp(System.currentTimeMillis());
        }
    }
    public static Date getDateFromString2(String strDate) {
        if (StringUtils.isEmpty(strDate)) {
          return  null;
        }
        try {
            return sdfLongTimePlus.parse(strDate);
        } catch (Exception ex) {
            return null;
        }
    }
    // -----------------------------------------------------------------------
@@ -2785,7 +2794,7 @@
            stringDate = getFomartDate(new Date(now), formate);
        } catch (ParseException e) {
        } catch (Exception e) {
            e.printStackTrace();
        }
@@ -2800,8 +2809,7 @@
            long now = date.getTime() + (long) Integer.parseInt(days) * DAY_IN_MILLISECOND;
            date = new Date(now);
        } catch (ParseException e) {
        } catch (Exception e) {
            e.printStackTrace();
        }
@@ -2818,10 +2826,16 @@
     *
     * 字符串形式转化为Date类型 String类型按照format格式转为Date类型
     **/
    public static Date fromStringToDate(String format, String dateTime) throws ParseException {
    public static Date fromStringToDate(String format, String dateTime)  {
        Date date = null;
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        date = sdf.parse(dateTime);
        try {
            SimpleDateFormat sdf = new SimpleDateFormat(format);
            date = sdf.parse(dateTime);
        }catch (Exception e){
        }
        return date;
    }