doum
2 天以前 46e8af542c02d801bea9fa8cf8f55974dcfa8554
server/system_service/src/main/java/com/doumee/core/utils/DateUtil.java
@@ -16,7 +16,6 @@
import cn.hutool.core.date.DateUnit;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
/**
 * 日期工具类
 * @author: jiangping
@@ -93,10 +92,11 @@
        Date nowAsISO = null;
        try {
            nowAsISO = df.parse(date);
        } catch (ParseException e) {
        } catch (Exception e) {
        }
        return nowAsISO;
    }
    public static Date getISO8601DateByStr2(String date)  {
        TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai");
        if(date!=null ){
@@ -112,7 +112,7 @@
        Date nowAsISO = null;
        try {
            nowAsISO = df.parse(date);
        } catch (ParseException e) {
        } catch (Exception e) {
        }
        return nowAsISO;
    }
@@ -2968,35 +2968,7 @@
    public static void main(String[] args) {
        try {
//            Date date = getISO8601DateByStr("2024-04-15T07:46:36.014+08:00");
//            Date date1 = getISO8601DateByStr("2024-06-14T08:46:36.014+08:00");
//            System.out.println(DateUtil.afterMinutesDate(-5));
            System.out.println(DateUtil.getFirstThisMonthDate());
//            System.out.println(getPlusTime2(DateUtil.addMonthToDate(new Date(),-1)));
//            System.out.println(DateUtil.getBeforMonthStr(new Date(),12));
//            List<Date> list =getThisMonthDateList();
//            for(Date d :list){
//                System.out.println(getPlusTime2(d));
//            }
//            List<Date> list1 =getThisYearMonthList();
//            for(Date d :list1){
//                System.out.println(getPlusTime2(d));
//            }
//            Date startTime = DateUtil.StringToDate("2024-05-01 08:00:00" ,"yyyy-MM-dd HH:mm:ss");
//            Date endTime = DateUtil.StringToDate("2024-05-01 17:00:00" ,"yyyy-MM-dd HH:mm:ss");
//            Long intervalTime = 35L;
//
//
//            DateUtil.checkDateInterval( startTime.toInstant()
//                    .atZone(ZoneId.systemDefault())
//                    .toLocalDateTime(), endTime.toInstant()
//                    .atZone(ZoneId.systemDefault())
//                    .toLocalDateTime(),intervalTime);
        System.out.println(getISO8601DateByStr("2025-12-26T03:08:39.123Z"));
        } catch (Exception ex) {
            ex.printStackTrace();
        }
@@ -3114,7 +3086,6 @@
        String temp = sdf.format(date);
        String firstDayInMoth = "";
        firstDayInMoth = temp + "-01";
        return firstDayInMoth;
    }
@@ -3147,7 +3118,8 @@
     */
    public static String getWeekZhouOfDate(Date dt) {
        String[] weekDays = { "周日", "周一", "周二", "周三", "周四", "周五", "周六" };
        Calendar cal = Calendar.getInstance();
        TimeZone china = TimeZone.getTimeZone("Asia/Shanghai");
        Calendar cal = Calendar.getInstance(china);
        cal.setTime(dt);
        int w = cal.get(Calendar.DAY_OF_WEEK) - 1;