GithubHelp home page GithubHelp logo

Comments (2)

venusdrogon avatar venusdrogon commented on June 16, 2024

已经新增 5f4e359

   /**
     * 将 开始时间 <code>beginDate</code> 到当前时间 <code>new Date()</code>,两日期之间的<span style="color:red">绝对值</span>间隔,转换成直观的表示方式.
     * 
     * <h3>说明:</h3>
     * <blockquote>
     * <ol>
     * <li>常用于日志输出一段代码执行时长</li>
     * <li>计算的是开始时间 <code>beginDate</code> 到当前时间 <code>new Date()</code> 绝对值间隔时间,也就是说不care 时间先后顺序</li>
     * <li>间隔时间转成 天,小时,分钟,秒,毫秒 中文文字</li>
     * </ol>
     * </blockquote>
     * 
     * <h3>示例:</h3>
     * <blockquote>
     * 
     * <pre class="code">
     * Date beginDate = new Date();
     * 
     * // do some logic
     * // balabala logic
     * 
     * LOGGER.info("use time:}{}", DateExtensionUtil.getIntervalForView(beginDate));
     * 
     * </pre>
     * 
     * </blockquote>
     * 
     * <h3>示例:</h3>
     * 
     * <blockquote>
     * <p>
     * 如果当前时间是 2016-07-09 13:03:53.259
     * </p>
     * 
     * <pre class="code">
     * Date date = toDate("2016-07-03 00:00:00", COMMON_DATE_AND_TIME);
     * LOGGER.debug(getIntervalForView(date));
     * </pre>
     * 
     * 返回 :
     * 
     * <pre class="code">
     * 6天13小时3分钟53秒259毫秒
     * </pre>
     * 
     * </blockquote>
     * 
     * @param beginDate
     *            开始日期
     * @return 如果 <code>beginDate</code> 是null,抛出 {@link NullPointerException}<br>
     * @see #getIntervalForView(Date, Date)
     * @see org.apache.commons.lang3.time.DurationFormatUtils#formatDurationWords(long, boolean, boolean)
     * @since 1.8.0
     */
    public static String getIntervalForView(Date beginDate){
        return getIntervalForView(beginDate, new Date());
    }

from feilong-core.

venusdrogon avatar venusdrogon commented on June 16, 2024

close

from feilong-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.