jiangping
2025-02-19 c977f0e2fd86ca3e9e3ad3961f702206c41d2767
server/services/src/main/java/com/doumee/core/utils/DateUtil.java
@@ -68,6 +68,15 @@
        return dt1;
    }
    public static String getXDaysAfter(Date date, Integer days){
        Timestamp currentTimestamp = new Timestamp(date.getTime());
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(currentTimestamp);
        calendar.add(Calendar.DAY_OF_YEAR, days-1); // 在当前时间基础上添加指定的天数
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        return formatter.format(calendar.getTime());
    }
    /**
     * @author Pablo Descrption:ȡ�õ�ǰ����getgetg get Date format
     *         Example:2008-05-15
@@ -2154,19 +2163,19 @@
    /**
     * 得出两个日期之间的间隔天数
     *
     * @param strFromDate
     * @param smallDate
     *            格式为yyyy-MM-dd
     * @param strToDate
     * @param bigDate
     *            格式为yyyy-MM-dd
     * @return int
     */
    public static long getBetweenDays(String strFromDate, String strToDate) {
    public static long getBetweenDays(String smallDate, String bigDate) {
        long m_intervalday = 0;// 初始化时间间隔的值为0
        // 使用的时间格式为yyyy-MM-dd
        SimpleDateFormat m_simpledateformat = new SimpleDateFormat("yyyy-MM-dd");
        try {
            Date fromDate = m_simpledateformat.parse(strFromDate);
            Date toDate = m_simpledateformat.parse(strToDate);
            Date fromDate = m_simpledateformat.parse(smallDate);
            Date toDate = m_simpledateformat.parse(bigDate);
            m_intervalday = toDate.getTime() - fromDate.getTime();// 计算所得为微秒数
            m_intervalday = m_intervalday / 1000 / 60 / 60 / 24;// 计算所得的天数
@@ -2762,8 +2771,7 @@
    public static void main(String[] args) {
        try {
            System.out.println((int)(3.222));
            System.out.println(DateUtil.getBetweenDays("2025-02-13","2025-02-15"));
        } catch (Exception ex) {
            ex.printStackTrace();
        }