common_helper/src/main/java/com/xiongyingqi/util/CalendarHelper.java
public static String caculatorDateToString(Date date) {
        long milliSecond = compareDate(date);
        List dateCaculators = DateCalculator.getDateCalculators();
        for (Iterator iterator = dateCaculators.iterator(); iterator.hasNext(); ) {
            DateCalculator dateCalculator = (DateCalculator) iterator.next();
            if (milliSecond >= dateCalculator.getMinMilliSecond()
                    && milliSecond <= dateCalculator.getMaxMilliSecond()) {
                String displayStr = dateCalculator.getDisplayStr();
                long numberOfUnit = 0;
                if (dateCalculator.getMinMilliSecond() == 0) { // 分母为零，则直接为0
                    numberOfUnit = 0;
                } else {
                    numberOfUnit = milliSecond / dateCalculator.getMinMilliSecond();
                }

                // 替代所有{0}
                Pattern p = Pattern.compile("(\\{.+?\\})");
                Matcher m = p.matcher(displayStr);
                displayStr = m.replaceAll(numberOfUnit + "");

                // displayStr = displayStr.replace("\\{0\\}", numberOfUnit +
                // "");
                return displayStr;
            }
        }
        return milliSecond + "";
    }
public static String caculatorDateToString(Date date) {
        long milliSecond = compareDate(date);
        List dateCaculators = DateCalculator.getDateCalculators();
        for (Iterator iterator = dateCaculators.iterator(); iterator.hasNext(); ) {
            DateCalculator dateCalculator = (DateCalculator) iterator.next();
            if (milliSecond >= dateCalculator.getMinMilliSecond()
                    && milliSecond <= dateCalculator.getMaxMilliSecond()) {
                String displayStr = dateCalculator.getDisplayStr();
                long numberOfUnit = 0;
                if (dateCalculator.getMinMilliSecond() == 0) { // 分母为零，则直接为0
                    numberOfUnit = 0;
                } else {
                    numberOfUnit = milliSecond / dateCalculator.getMinMilliSecond();
                }

                // 替代所有{0}
                Pattern p = Pattern.compile("(\\{.+?\\})");
                Matcher m = p.matcher(displayStr);
                displayStr = m.replaceAll(numberOfUnit + "");

                // displayStr = displayStr.replace("\\{0\\}", numberOfUnit +
                // "");
                return displayStr;
            }
        }
        return milliSecond + "";
    }
计算指定日期到现在的时间计算

@param date
@return