Comments (2)
已经新增 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.
close
from feilong-core.
Related Issues (20)
- 新建 com.feilong.core.lang.thread 包, 将thread 相关类 移动进来
- 新建 ThreadUtil.execute(List<T>, int, PartitionPerHandler<T>)
- 新建 ThreadUtil.execute(List<T>, int, Map<String, ?>, PartitionPerHandler<T>)
- 新建 ThreadUtil.execute(List<T>, PartitionThreadConfig, Map<String, ?>, PartitionPerHandler<T>)
- ParamUtil 新增 toNaturalOrderingJoinValue(Map<String, String>) 方法
- 能否在AndroidStudio中使用? HOT 1
- Sonar A "NullPointerException" could be thrown; "couponCode" is nullable here HOT 1
- dateutil 新增 将一个时间格式字符串转成另外时间格式字符串方法
- list 根据多个属性去重 HOT 1
- Dateutil 新增 日期字符串区间的比较
- 修改 AggregateUtil.groupCount(Iterable<O>, String...) javadoc
- 修改 AggregateUtil.sum(Iterable<O>, String...) javadoc
- 完善 DefaultRuntimeException(String, Object...) 注释
- 新增 CollectionsUtil.find(Iterable<O>, Map<String, ?>) 方法
- 新建 DateUtil.nowTimestamp() 方法
- 新增 RandomUtil.createRandomString(int) 减少一步代码
- ReflectUtil getConstructor有问题,我是从BeanUtil.toBean(Object source, Class<T> clazz)那里跟过来的 HOT 1
- 基于sonar8 修复坏味道 HOT 1
- hutool 调用webservice HOT 1
- StrUtil工具类能增加一个isAnyBlank吗 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from feilong-core.