jiangping
2023-09-28 35baa39723180e0de2350b5b2287b1846dabaf58
server/services/src/main/java/com/doumee/core/utils/DateUtil.java
ÎļþÃû´Ó server/src/main/java/com/doumee/core/utils/DateUtil.java ÐÞ¸Ä
@@ -40,12 +40,12 @@
    public DateUtil() {
    }
    public static java.util.Date StringToDate2(String DATE) {
    public static Date StringToDate2(String DATE) {
        if(StringUtils.isBlank(DATE)){
            return null;
        }
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        java.util.Date dt1 = null;
        Date dt1 = null;
        try {
            dt1 = df.parse(DATE);
        } catch (Exception exception) {
@@ -60,7 +60,7 @@
     * @return String
     * @throws Exception
     */
    public static String getDateLong(java.util.Date date) {
    public static String getDateLong(Date date) {
        String nowDate = "";
        try {
            if (date != null)
@@ -72,7 +72,7 @@
        }
    }
    public static String getDateLongSlash(java.util.Date date) {
    public static String getDateLongSlash(Date date) {
        String nowDate = "";
        try {
            if (date != null)
@@ -93,7 +93,7 @@
     *            æ ¼å¼ä¸ºyyyy-MM-dd
     * @return int
     */
    public static long getBetweenHours(java.util.Date fromDate, java.util.Date toDate) {
    public static long getBetweenHours(Date fromDate, Date toDate) {
        long m_intervalday = 0;// åˆå§‹åŒ–时间间隔的值为0
        // ä½¿ç”¨çš„æ—¶é—´æ ¼å¼ä¸ºyyyy-MM-dd
        try {
@@ -112,7 +112,7 @@
     * @return String
     * @throws Exception
     */
    public static String getDateShortPoint(java.util.Date date) {
    public static String getDateShortPoint(Date date) {
        String nowDate = "";
        try {
            if (date != null)
@@ -124,7 +124,7 @@
        }
    }
    public static int getDateNum(java.util.Date date) {
    public static int getDateNum(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        try {
@@ -141,7 +141,7 @@
     * @return String
     * @throws Exception
     */
    public static String getDateLongCn(java.util.Date date) {
    public static String getDateLongCn(Date date) {
        String nowDate = "";
        try {
            if (date != null)
@@ -158,7 +158,7 @@
     * @return String
     * @throws Exception
     */
    public static String getDateMD(java.util.Date date) {
    public static String getDateMD(Date date) {
        String nowDate = "";
        try {
            if (date != null)
@@ -176,7 +176,7 @@
     * @return String
     * @throws Exception
     */
    public static String getDateShortLongTimeCn(java.util.Date date) {
    public static String getDateShortLongTimeCn(Date date) {
        String nowDate = "";
        try {
            if (date != null)
@@ -194,7 +194,7 @@
     * @return String
     * @throws Exception
     */
    public static String getDateUS(java.util.Date date) {
    public static String getDateUS(Date date) {
        String nowDate = "";
        try {
            if (date != null)
@@ -212,7 +212,7 @@
     * @return String
     * @throws Exception
     */
    public static String getDateUSShort(java.util.Date date) {
    public static String getDateUSShort(Date date) {
        String nowDate = "";
        try {
            if (date != null)
@@ -231,12 +231,12 @@
     * @param format
     * @return String
     */
    public static String getFomartDate(java.util.Date date, String format) {
    public static String getFomartDate(Date date, String format) {
        try {
            return new SimpleDateFormat(format, Locale.UK).format(date);
        } catch (Exception e) {
            e.printStackTrace();
            return (date == null) ? new java.util.Date().toString() : date.toString();
            return (date == null) ? new Date().toString() : date.toString();
        }
    }
@@ -250,7 +250,7 @@
        String nowTime = "";
        try {
            java.sql.Date date = null;
            date = new java.sql.Date(new java.util.Date().getTime());
            date = new java.sql.Date(new Date().getTime());
            nowTime = sdfLongTime.format(date);
            return nowTime;
        } catch (Exception e) {
@@ -264,7 +264,7 @@
     * @return String
     * @throws Exception
     */
    public static String getHourMinute(java.util.Date date) throws Exception {
    public static String getHourMinute(Date date) throws Exception {
        String nowTime = "";
        try {
            if (date != null) {
@@ -286,7 +286,7 @@
        String nowDate = "";
        try {
            java.sql.Date date = null;
            date = new java.sql.Date(new java.util.Date().getTime());
            date = new java.sql.Date(new Date().getTime());
            nowDate = sdfShort.format(date);
            return nowDate;
        } catch (Exception e) {
@@ -304,7 +304,7 @@
        String nowDate = "";
        try {
            java.sql.Date date = null;
            date = new java.sql.Date(new java.util.Date().getTime());
            date = new java.sql.Date(new Date().getTime());
            nowDate = sdfLong.format(date);
            return nowDate;
        } catch (Exception e) {
@@ -322,7 +322,7 @@
        String nowDate = "";
        try {
            java.sql.Date date = null;
            date = new java.sql.Date(new java.util.Date().getTime());
            date = new java.sql.Date(new Date().getTime());
            nowDate = sdfLongTimePlus.format(date);
            return nowDate;
        } catch (Exception e) {
@@ -336,7 +336,7 @@
     * @return String
     * @throws Exception
     */
    public static String getPlusTime(java.util.Date date) throws Exception {
    public static String getPlusTime(Date date) throws Exception {
        if (date == null)
            return null;
        try {
@@ -353,7 +353,7 @@
     * @return String
     * @throws Exception
     */
    public static String getPlusTime2(java.util.Date date) {
    public static String getPlusTime2(Date date) {
        if (date == null)
            return "";
@@ -376,7 +376,7 @@
        String nowDate = "";
        try {
            java.sql.Date date = null;
            date = new java.sql.Date(new java.util.Date().getTime());
            date = new java.sql.Date(new Date().getTime());
            nowDate = sdfLongTimePlusMill.format(date);
            return nowDate;
        } catch (Exception e) {
@@ -488,7 +488,7 @@
     * @return String
     * @throws Exception
     */
    public static String getPlusTimeSecond(java.util.Date date) throws Exception {
    public static String getPlusTimeSecond(Date date) throws Exception {
        if (date == null)
            return null;
        try {
@@ -538,7 +538,7 @@
     *            æ—¥æœŸ
     * @return yyyy格式的年份
     */
    public static int convertDateToYear(java.util.Date date) {
    public static int convertDateToYear(Date date) {
        SimpleDateFormat df = new SimpleDateFormat("yyyy", new DateFormatSymbols());
        return Integer.parseInt(df.format(date));
    }
@@ -550,7 +550,7 @@
     *            æ—¥æœŸ
     * @return yyyyMM格式的年月字符串
     */
    public static String convertDateToYearMonth(java.util.Date d) {
    public static String convertDateToYearMonth(Date d) {
        SimpleDateFormat df = new SimpleDateFormat("yyyyMM", new DateFormatSymbols());
        return df.format(d);
    }
@@ -562,7 +562,7 @@
     *            æ—¥æœŸ
     * @return yyyyMMdd格式的年月日字符串
     */
    public static String convertDateToYearMonthDay(java.util.Date d) {
    public static String convertDateToYearMonthDay(Date d) {
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd", new DateFormatSymbols());
        return df.format(d);
    }
@@ -574,7 +574,7 @@
     *            æ—¥æœŸ
     * @return yyyy格式的年份
     */
    public static String convertDateToMonth(java.util.Date d) {
    public static String convertDateToMonth(Date d) {
        SimpleDateFormat df = new SimpleDateFormat("MM", new DateFormatSymbols());
        return df.format(d);
    }
@@ -585,7 +585,7 @@
     *            æ—¥æœŸ
     * @return yyyy格式的年份
     */
    public static String convertDateToDay(java.util.Date d) {
    public static String convertDateToDay(Date d) {
        SimpleDateFormat df = new SimpleDateFormat("dd", new DateFormatSymbols());
        return df.format(d);
    }
@@ -596,7 +596,7 @@
     *            æ—¥æœŸ
     * @return HH格式的小时
     */
    public static String convertDateToHour(java.util.Date d) {
    public static String convertDateToHour(Date d) {
        SimpleDateFormat df = new SimpleDateFormat("HH", new DateFormatSymbols());
        return df.format(d);
    }
@@ -608,7 +608,7 @@
     *            æ—¥æœŸ
     * @return mm格式的分钟
     */
    public static String convertDateToMinute(java.util.Date d) {
    public static String convertDateToMinute(Date d) {
        SimpleDateFormat df = new SimpleDateFormat("mm", new DateFormatSymbols());
        return df.format(d);
    }
@@ -618,11 +618,11 @@
     *
     * @return å½“前日期,java.util.Date类型
     */
    public static java.util.Date getCurrentDate() {
    public static Date getCurrentDate() {
        Calendar cal = Calendar.getInstance();
        // String currentDate = null;
        java.util.Date d = cal.getTime();
        Date d = cal.getTime();
        return d;
    }
@@ -632,11 +632,11 @@
     *
     * @return å½“前日期,java.util.Date类型
     */
    public static java.util.Date getCurrentDateDelay() {
    public static Date getCurrentDateDelay() {
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.SECOND, 1);
        // String currentDate = null;
        java.util.Date d = cal.getTime();
        Date d = cal.getTime();
        return d;
    }
@@ -862,7 +862,7 @@
     * @return è½¬æ¢å¾—到的日期
     */
    @SuppressWarnings("unchecked")
    public static java.util.Date stringToDate(String strDate, String oracleFormat) {
    public static Date stringToDate(String strDate, String oracleFormat) {
        if (strDate == null)
            return null;
        Hashtable<Integer, String> h = new Hashtable<Integer, String>();
@@ -941,7 +941,7 @@
        }
        SimpleDateFormat df = new SimpleDateFormat(javaFormat);
        java.util.Date myDate = new java.util.Date();
        Date myDate = new Date();
        try {
            myDate = df.parse(strDate);
        } catch (Exception e) {
@@ -952,9 +952,9 @@
        return myDate;
    }
    public static java.util.Date StringToDate(String DATE1) {
    public static Date StringToDate(String DATE1) {
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        java.util.Date dt1 = null;
        Date dt1 = null;
        try {
            dt1 = df.parse(DATE1);
        } catch (Exception exception) {
@@ -972,7 +972,7 @@
     *            - æŒ‡å®šæ—¥æœŸæ ¼å¼ï¼Œæ ¼å¼çš„写法为Oracle格式
     * @return æŒ‰æŒ‡å®šçš„æ—¥æœŸæ ¼å¼è½¬æ¢åŽçš„æ—¥æœŸå­—符串
     */
    public static String dateToString(java.util.Date d, String format) {
    public static String dateToString(Date d, String format) {
        if (d == null)
            return "";
        Hashtable<Integer, String> h = new Hashtable<Integer, String>();
@@ -1063,7 +1063,7 @@
     *            - æŒ‡å®šæ—¥æœŸæ ¼å¼ï¼Œæ ¼å¼çš„写法为Oracle格式
     * @return æŒ‰æŒ‡å®šçš„æ—¥æœŸæ ¼å¼è½¬æ¢åŽçš„æ—¥æœŸå­—符串
     */
    public static String getDate(java.util.Date d, String format) {
    public static String getDate(Date d, String format) {
        if (d == null)
            return "";
        Hashtable<Integer, String> h = new Hashtable<Integer, String>();
@@ -1227,7 +1227,7 @@
     *            å°çš„æ—¥æœŸ
     * @return newDate-oldDate相差的天数
     */
    public static int daysBetweenDates(java.util.Date newDate, java.util.Date oldDate) {
    public static int daysBetweenDates(Date newDate, Date oldDate) {
        long days = 0;
        try {
            long nDay = 0;
@@ -1250,7 +1250,7 @@
        return (int) days;
    }
    public static int daysBetweenDates11(java.util.Date newDate, java.util.Date oldDate) {
    public static int daysBetweenDates11(Date newDate, Date oldDate) {
        int days = 0;
        Calendar calo = Calendar.getInstance();
        Calendar caln = Calendar.getInstance();
@@ -1281,7 +1281,7 @@
     *            ç›¸å·®çš„天数
     * @return date加上intBetween天后的日期
     */
    public static java.util.Date getDateBetween(java.util.Date date, int intBetween) {
    public static Date getDateBetween(Date date, int intBetween) {
        Calendar calo = Calendar.getInstance();
        calo.setTime(date);
        calo.add(Calendar.DATE, intBetween);
@@ -1299,8 +1299,8 @@
     *            è¿”回日期的格式
     * @return date加上intBetween天后的日期
     */
    public static String getDateBetween_String(java.util.Date date, int intBetween, String strFromat) {
        java.util.Date dateOld = getDateBetween(date, intBetween);
    public static String getDateBetween_String(Date date, int intBetween, String strFromat) {
        Date dateOld = getDateBetween(date, intBetween);
        return getDate(dateOld, strFromat);
    }
@@ -1461,7 +1461,7 @@
     *            æ—¥æœŸ
     * @return æ ¼å¼åŒ–后的字符串
     */
    public static String getOracleFormatDateStr(java.util.Date date) {
    public static String getOracleFormatDateStr(Date date) {
        return getDate(date, "YYYY-MM-DD HH24:MI:SS");
    }
@@ -1590,7 +1590,7 @@
     *            å¹´æœˆç±»åž‹çš„字符串
     * @return String
     */
    public static String getYear(java.util.Date date) {
    public static String getYear(Date date) {
        if (null == date)
        {
            return "";
@@ -1664,7 +1664,7 @@
     *            å¢žåŠ çš„æœˆä»½
     * @return date åŠ ä¸ŠintBetween月数后的日期
     */
    public static java.util.Date increaseMonth(java.util.Date date, int intBetween) {
    public static Date increaseMonth(Date date, int intBetween) {
        Calendar calo = Calendar.getInstance();
        calo.setTime(date);
        calo.add(Calendar.MONTH, intBetween);
@@ -1680,7 +1680,7 @@
     *            å¢žåŠ çš„å¤©æ•°
     * @return date åŠ ä¸ŠintBetween天数后的日期
     */
    public static java.util.Date increaseDay(java.util.Date date, int intBetween) {
    public static Date increaseDay(Date date, int intBetween) {
        if (date == null) {
            return null;
        }
@@ -1699,7 +1699,7 @@
     *            å¢žåŠ çš„å¹´æ•°
     * @return date加上intBetween年数后的日期
     */
    public static java.util.Date increaseYear(java.util.Date date, int intBetween) {
    public static Date increaseYear(Date date, int intBetween) {
        Calendar calo = Calendar.getInstance();
        calo.setTime(date);
        calo.add(Calendar.YEAR, intBetween);
@@ -1718,7 +1718,7 @@
     */
    public static int compareDate(String str1, String str2) {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        java.util.Date date1 = null, date2 = null;
        Date date1 = null, date2 = null;
        try {
            date1 = formatter.parse(str1);
            date2 = formatter.parse(str2);
@@ -1738,7 +1738,7 @@
     * @return int negative integer, zero, or a positive integer as str1 is less
     *         than, equal to, or greater than str2
     */
    public static int compareDate(java.util.Date date1, java.util.Date date2) {
    public static int compareDate(Date date1, Date date2) {
        if (date1 == null && date2 == null) {
            return 0;
        }
@@ -1752,7 +1752,7 @@
        return date2.compareTo(date1);
    }
    public static int compare_date(java.util.Date dt1, java.util.Date dt2, java.util.Date dtime) {
    public static int compare_date(Date dt1, Date dt2, Date dtime) {
        try {
            if (dtime.compareTo(dt1) >= 0 && dt2.compareTo(dtime) >= 0) {
                return 1;
@@ -1765,14 +1765,14 @@
        return 0;
    }
    public static int compareDate(String str1, java.util.Date date2) {
        java.util.Date date1 = getDateByString(str1);
    public static int compareDate(String str1, Date date2) {
        Date date1 = getDateByString(str1);
        return date1.compareTo(date2);
    }
    public static int compareDate(String format, String str1, java.util.Date date2) {
    public static int compareDate(String format, String str1, Date date2) {
        java.util.Date date1 = null;
        Date date1 = null;
        try {
            date1 = fromStringToDate(format, str1);
        } catch (ParseException e) {
@@ -1830,7 +1830,7 @@
     * @return String æ ¼å¼åŒ–的日期字符串
     */
    public static String getToday() {
        java.util.Date cDate = new java.util.Date();
        Date cDate = new Date();
        SimpleDateFormat cSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        return cSimpleDateFormat.format(cDate);
    }
@@ -1841,7 +1841,7 @@
     * @return String æ ¼å¼åŒ–的日期字符串
     */
    public static String getYesterday() {
        java.util.Date cDate = new java.util.Date();
        Date cDate = new Date();
        cDate.setTime(cDate.getTime() - 24 * 3600 * 1000);
        SimpleDateFormat cSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        return cSimpleDateFormat.format(cDate);
@@ -1853,7 +1853,7 @@
     * @return String æ ¼å¼åŒ–的日期字符串
     */
    public static String getTomorrow() {
        java.util.Date cDate = new java.util.Date();
        Date cDate = new Date();
        cDate.setTime(cDate.getTime() + 24 * 3600 * 1000);
        SimpleDateFormat cSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        return cSimpleDateFormat.format(cDate);
@@ -2114,7 +2114,7 @@
        return szTime;
    }
    public static String getFormattedDateUtil(java.util.Date dtDate, String strFormatTo) {
    public static String getFormattedDateUtil(Date dtDate, String strFormatTo) {
        if (dtDate == null) {
            return "";
        }
@@ -2142,8 +2142,8 @@
        // ä½¿ç”¨çš„æ—¶é—´æ ¼å¼ä¸ºyyyy-MM-dd
        SimpleDateFormat m_simpledateformat = new SimpleDateFormat("yyyy-MM-dd");
        try {
            java.util.Date fromDate = m_simpledateformat.parse(strFromDate);
            java.util.Date toDate = m_simpledateformat.parse(strToDate);
            Date fromDate = m_simpledateformat.parse(strFromDate);
            Date toDate = m_simpledateformat.parse(strToDate);
            m_intervalday = toDate.getTime() - fromDate.getTime();// è®¡ç®—所得为微秒数
            m_intervalday = m_intervalday / 1000 / 60 / 60 / 24;// è®¡ç®—所得的天数
@@ -2222,13 +2222,13 @@
     * before midnight. If a null day is passed in, a new Date is created.
     * midnight (00m 00h 00s)
     */
    public static java.util.Date getEndOfDay(java.util.Date day) {
    public static Date getEndOfDay(Date day) {
        return getEndOfDay(day, Calendar.getInstance());
    }
    public static java.util.Date getEndOfDay(java.util.Date day, Calendar cal) {
    public static Date getEndOfDay(Date day, Calendar cal) {
        if (day == null)
            day = new java.util.Date();
            day = new Date();
        cal.setTime(day);
        cal.set(Calendar.HOUR_OF_DAY, cal.getMaximum(Calendar.HOUR_OF_DAY));
        cal.set(Calendar.MINUTE, cal.getMaximum(Calendar.MINUTE));
@@ -2243,7 +2243,7 @@
     * after midnight. If a null day is passed in, a new Date is created.
     * midnight (00m 00h 00s)
     */
    public static java.util.Date getStartOfDay(java.util.Date day) {
    public static Date getStartOfDay(Date day) {
        return getStartOfDay(day, Calendar.getInstance());
    }
@@ -2252,9 +2252,9 @@
     * after midnight. If a null day is passed in, a new Date is created.
     * midnight (00m 00h 00s)
     */
    public static java.util.Date getStartOfDay(java.util.Date day, Calendar cal) {
    public static Date getStartOfDay(Date day, Calendar cal) {
        if (day == null)
            day = new java.util.Date();
            day = new Date();
        cal.setTime(day);
        cal.set(Calendar.HOUR_OF_DAY, cal.getMinimum(Calendar.HOUR_OF_DAY));
        cal.set(Calendar.MINUTE, cal.getMinimum(Calendar.MINUTE));
@@ -2268,10 +2268,10 @@
     * the day. If a null day is passed in, a new Date is created. nnoon (00m
     * 12h 00s)
     */
    public static java.util.Date getNoonOfDay(java.util.Date day, Calendar cal) {
    public static Date getNoonOfDay(Date day, Calendar cal) {
        if (day == null)
        {
            day = new java.util.Date();
            day = new Date();
        }
        cal.setTime(day);
        cal.set(Calendar.HOUR_OF_DAY, 12);
@@ -2288,9 +2288,9 @@
     *            String æ—¥æœŸå­—符串
     * @return java.util.Date æ—¥æœŸå¯¹è±¡
     */
    public static java.util.Date getDateFromString(String strDate) {
    public static Date getDateFromString(String strDate) {
        if (StringUtils.isEmpty(strDate)) {
            return new java.util.Date(System.currentTimeMillis());
            return new Date(System.currentTimeMillis());
        }
        try {
            return sdfLongTimePlus.parse(strDate);
@@ -2300,7 +2300,7 @@
    }
    // -----------------------------------------------------------------------
    public static java.util.Date parseFromFormats(String aValue) {
    public static Date parseFromFormats(String aValue) {
        if (StringUtils.isEmpty(aValue))
            return null;
@@ -2310,7 +2310,7 @@
            return null;
        // iterate over the array and parse
        java.util.Date myDate = null;
        Date myDate = null;
        for (int i = 0; i < formats.length; i++) {
            try {
                myDate = DateUtil.parse(aValue, formats[i]);
@@ -2333,7 +2333,7 @@
        }
        // call the regular Date formatter
        java.util.Date myDate = DateUtil.parseFromFormats(aValue);
        Date myDate = DateUtil.parseFromFormats(aValue);
        if (myDate != null)
        {
            return new Timestamp(myDate.getTime());
@@ -2355,7 +2355,7 @@
     * the passed-in format. Returns an empty string if the date or the format
     * is null.
     **/
    public static String format(java.util.Date aDate, SimpleDateFormat aFormat) {
    public static String format(Date aDate, SimpleDateFormat aFormat) {
        if (aDate == null || aFormat == null) {
            return "";
        }
@@ -2389,7 +2389,7 @@
     * string is null or empty or if the format is null. The string must match
     * the format.
     **/
    public static java.util.Date parse(String aValue, SimpleDateFormat aFormat) throws ParseException {
    public static Date parse(String aValue, SimpleDateFormat aFormat) throws ParseException {
        if (StringUtils.isEmpty(aValue) || aFormat == null) {
            return null;
        }
@@ -2402,7 +2402,7 @@
     * Returns true if endDate is after startDate or if startDate equals endDate
     * or if they are the same date. Returns false if either value is null.
     **/
    public static boolean isValidDateRange(java.util.Date startDate, java.util.Date endDate) {
    public static boolean isValidDateRange(Date startDate, Date endDate) {
        return isValidDateRange(startDate, endDate, true);
    }
@@ -2412,7 +2412,7 @@
     * endDate. Returns false if either value is null. If equalOK, returns true
     * if the dates are equal.
     **/
    public static boolean isValidDateRange(java.util.Date startDate, java.util.Date endDate, boolean equalOK) {
    public static boolean isValidDateRange(Date startDate, Date endDate, boolean equalOK) {
        // false if either value is null
        if (startDate == null || endDate == null) {
            return false;
@@ -2453,13 +2453,13 @@
    // -----------------------------------------------------------------------
    // convenience method
    public static String defaultTimestamp(java.util.Date date) {
    public static String defaultTimestamp(Date date) {
        return DateUtil.format(date, DateUtil.defaultTimestampFormat());
    }
    // -----------------------------------------------------------------------
    // convenience method
    public static String defaultDate(java.util.Date date) {
    public static String defaultDate(Date date) {
        return DateUtil.format(date, DateUtil.defaultDateFormat());
    }
@@ -2471,19 +2471,19 @@
    // -----------------------------------------------------------------------
    // convenience method returns long friendly formatted timestamp
    public static String friendlyTimestamp(java.util.Date date) {
    public static String friendlyTimestamp(Date date) {
        return DateUtil.format(date, DateUtil.friendlyTimestampFormat());
    }
    // -----------------------------------------------------------------------
    // convenience method returns long friendly formatted timestamp
    public static String format8chars(java.util.Date date) {
    public static String format8chars(Date date) {
        return DateUtil.format(date, mFormat8chars);
    }
    // -----------------------------------------------------------------------
    // convenience method returns long friendly formatted timestamp
    public static String formatIso8601Day(java.util.Date date) {
    public static String formatIso8601Day(Date date) {
        return DateUtil.format(date, mFormatIso8601Day);
    }
@@ -2493,18 +2493,18 @@
        return DateUtil.format(calendar.getTime(), mFormatIso8601Day);
    }
    public static String formatTradeEasy(java.util.Date date) {
    public static String formatTradeEasy(Date date) {
        return DateUtil.format(date, mFormatTradeEasy);
    }
    // add by huyanzhi
    public static String formatTradeEasyProduct(java.util.Date date) {
    public static String formatTradeEasyProduct(Date date) {
        return DateUtil.format(date, mFormatTradeEasyProduct);
    }
    //
    public static String formatFormatTradeEasyMMddyyyy(java.util.Date date) {
    public static String formatFormatTradeEasyMMddyyyy(Date date) {
        return DateUtil.format(date, mFormatTradeEasyMMddyyyy);
    }
@@ -2515,17 +2515,17 @@
    }
    // -----------------------------------------------------------------------
    public static String formatRfc822(java.util.Date date) {
    public static String formatRfc822(Date date) {
        return DateUtil.format(date, mFormatRfc822);
    }
    public static String formatExpire(java.util.Date date) {
    public static String formatExpire(Date date) {
        return DateUtil.format(date, mFormatExpire);
    }
    // -----------------------------------------------------------------------
    // This is a hack, but it seems to work
    public static String formatIso8601(java.util.Date date) {
    public static String formatIso8601(Date date) {
        if (date == null)
            return "";
@@ -2548,7 +2548,7 @@
    // -----------------------------------------------------------------------
    // convenience method using minimal date format
    public static String minimalDate(java.util.Date date) {
    public static String minimalDate(Date date) {
        return DateUtil.format(date, DateUtil.minimalDateFormat());
    }
@@ -2560,7 +2560,7 @@
    }
    // -----------------------------------------------------------------------
    public static String fullDate(java.util.Date date) {
    public static String fullDate(Date date) {
        return DateUtil.format(date, DateUtil.fullDateFormat());
    }
@@ -2583,18 +2583,18 @@
    /**
     * Format the date using the "friendly" date format.
     */
    public static String friendlyDate(java.util.Date date, boolean minimalFormat) {
    public static String friendlyDate(Date date, boolean minimalFormat) {
        return DateUtil.format(date, DateUtil.friendlyDateFormat(minimalFormat));
    }
    // -----------------------------------------------------------------------
    // convenience method
    public static String friendlyDate(java.util.Date date) {
    public static String friendlyDate(Date date) {
        return DateUtil.format(date, DateUtil.friendlyDateFormat(true));
    }
    public static java.util.Date parseFormatIso8601Date(String date) throws Exception {
        java.util.Date returnDate = null;
    public static Date parseFormatIso8601Date(String date) throws Exception {
        Date returnDate = null;
        try {
            returnDate = mFormatIso8601Day.parse(date);
        } catch (Exception e) {
@@ -2609,7 +2609,7 @@
        String Sdate = "";
        try {
            GregorianCalendar grc = new GregorianCalendar();
            grc.setTime(new java.util.Date(date));
            grc.setTime(new Date(date));
            if (type.equals("D")) {
                grc.add(GregorianCalendar.DATE, into);
            } else if (type.equals("M")) {
@@ -2632,7 +2632,7 @@
            date = date.replaceAll("-", "/");
            date = date.substring(0, date.length() - 2);
            GregorianCalendar grc = new GregorianCalendar();
            grc.setTime(new java.util.Date(date));
            grc.setTime(new Date(date));
            grc.add(GregorianCalendar.DATE, Integer.parseInt(into));
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
            Sdate = new String(formatter.format(grc.getTime()));
@@ -2642,7 +2642,7 @@
        return Sdate;
    }
    public static String formatDate(java.util.Date date, String pattern) {
    public static String formatDate(Date date, String pattern) {
        if (date == null) {
            return null;
        }
@@ -2662,7 +2662,7 @@
            date = date.replaceAll("-", "/");
            date = date.substring(0, date.length() - 2);
            GregorianCalendar grc = new GregorianCalendar();
            grc.setTime(new java.util.Date(date));
            grc.setTime(new Date(date));
            grc.add(GregorianCalendar.DATE, Integer.parseInt(into));
            Sdate = new String(mFormatExpire.format(grc.getTime()));
        } catch (Exception e) {
@@ -2674,10 +2674,10 @@
    public static String addDayToStringDate(String formate, String strDate, String days) {
        String stringDate = null;
        try {
            java.util.Date date = fromStringToDate(formate, strDate);
            Date date = fromStringToDate(formate, strDate);
            long now = date.getTime() + (long) Integer.parseInt(days) * DAY_IN_MILLISECOND;
            stringDate = getFomartDate(new java.util.Date(now), formate);
            stringDate = getFomartDate(new Date(now), formate);
        } catch (ParseException e) {
@@ -2687,13 +2687,13 @@
        return stringDate;
    }
    public static java.util.Date addDayToStringDate2(String formate, String strDate, String days) {
        java.util.Date date = null;
    public static Date addDayToStringDate2(String formate, String strDate, String days) {
        Date date = null;
        try {
            date = fromStringToDate(formate, strDate);
            long now = date.getTime() + (long) Integer.parseInt(days) * DAY_IN_MILLISECOND;
            date = new java.util.Date(now);
            date = new Date(now);
        } catch (ParseException e) {
@@ -2703,17 +2703,17 @@
        return date;
    }
    public static java.util.Date dateDayAdd(java.util.Date date, int days) {
    public static Date dateDayAdd(Date date, int days) {
        long now = date.getTime() + (long) days * DAY_IN_MILLISECOND;
        return new java.util.Date(now);
        return new Date(now);
    }
    /**
     *
     * å­—符串形式转化为Date类型 String类型按照format格式转为Date类型
     **/
    public static java.util.Date fromStringToDate(String format, String dateTime) throws ParseException {
        java.util.Date date = null;
    public static Date fromStringToDate(String format, String dateTime) throws ParseException {
        Date date = null;
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        date = sdf.parse(dateTime);
        return date;
@@ -2723,7 +2723,7 @@
     *
     * å­—符串形式转化为Date类型 String类型按照format格式转为Date类型
     **/
    public static java.util.Date fromStringToDate(java.util.Date date) throws ParseException {
    public static Date fromStringToDate(Date date) throws ParseException {
        return sdfLongTimePlus.parse(sdfLongTimePlus.format(date));
    }
@@ -2745,7 +2745,7 @@
     * @param date
     * @return
     */
    public static Integer getTimeFormatIntger(java.util.Date date) {
    public static Integer getTimeFormatIntger(Date date) {
        if (date == null) {
            return 0;
        }
@@ -2754,7 +2754,7 @@
        return Integer.valueOf(nowTime);
    }
    public static String getNowDayStr(java.util.Date date) {
    public static String getNowDayStr(Date date) {
        if (date == null) {
            return "";
        }
@@ -2776,7 +2776,7 @@
     */
    public static String toDayToStr(String format) {
        try {
            java.util.Date now = new java.util.Date();
            Date now = new Date();
            return DateToStr(now, format) + " " + getWeekOfDate(now);
        } catch (Exception e) {
            System.out.println("Date è½¬ String ç±»åž‹å¤±è´¥: " + e);
@@ -2792,7 +2792,7 @@
     * @author zhangyong
     * @return String
     */
    public static String DateToStr(java.util.Date date, String format) {
    public static String DateToStr(Date date, String format) {
        try {
            SimpleDateFormat sdf = new SimpleDateFormat(format);
            return sdf.format(date);
@@ -2809,9 +2809,9 @@
     * @param date
     *            date, int days
     */
    public static java.util.Date dateAddDays(java.util.Date date, int days) {
    public static Date dateAddDays(Date date, int days) {
        long now = date.getTime() + (long) days * DAY_IN_MILLISECOND;
        return new java.util.Date(now);
        return new Date(now);
    }
    /**
@@ -2820,7 +2820,7 @@
     * @param date
     *            date,String fFormatStr eg:yyyy-MM-dd HH:mm:ss
     */
    public static String dateTypeToString(java.util.Date date, String fFormatStr) {
    public static String dateTypeToString(Date date, String fFormatStr) {
        // yyyy-MM-dd HH:mm:ss
        SimpleDateFormat dateformat = new SimpleDateFormat(fFormatStr);
        String strDate = dateformat.format(date);
@@ -2834,7 +2834,7 @@
     * @获取当前的系统时间,并按照固定的格式初始话
     */
    public static String getStringOfNowDate(String fFormatStr) {
        String nowDateString = dateTypeToString(new java.util.Date(), fFormatStr);
        String nowDateString = dateTypeToString(new Date(), fFormatStr);
        return nowDateString;
    }
@@ -2842,7 +2842,7 @@
     * @ author zhangyong @ èŽ·å–å½“æœˆçš„ç¬¬ä¸€å¤©ï¼Œ2009-05-01
     */
    public static String getStringOfFirstDayInMonth() {
        java.util.Date date = new java.util.Date();
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
        String temp = sdf.format(date);
        String firstDayInMoth = "";
@@ -2858,7 +2858,7 @@
     * @param dt
     * @return å½“前日期是星期几
     */
    public static String getWeekOfDate(java.util.Date dt) {
    public static String getWeekOfDate(Date dt) {
        String[] weekDays = { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
        Calendar cal = Calendar.getInstance();
        cal.setTime(dt);
@@ -2878,7 +2878,7 @@
     * @param dt
     * @return
     */
    public static int getWeekNumOfDate(java.util.Date dt) {
    public static int getWeekNumOfDate(Date dt) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(dt);
@@ -2889,7 +2889,7 @@
        return w;
    }
    public static Long twoDaysBetween(java.util.Date beginDate, java.util.Date endDate) throws ParseException {
    public static Long twoDaysBetween(Date beginDate, Date endDate) throws ParseException {
        long minute = (endDate.getTime() - beginDate.getTime()) / (60 * 1000);
        return minute;
    }
@@ -2899,9 +2899,9 @@
     *
     * @return
     */
    public static java.util.Date initDateByTwoMonthAgo() {
    public static Date initDateByTwoMonthAgo() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new java.util.Date());
        calendar.setTime(new Date());
        calendar.set(Calendar.DAY_OF_MONTH, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
@@ -2915,7 +2915,7 @@
     *
     * @return
     */
    public static java.util.Date addDaysToDate(Date date, int days) {
    public static Date addDaysToDate(Date date, int days) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.add(Calendar.DATE, days);//