使用 DurationFormatUtils 计算时间间隔
2016-11-16 14:23
736 查看
// 当前时间 Date now = new Date(); // 2010上海世博会开幕时间 Date expo2010BeginDate = DateUtils.parseDate("2010-05-01 23:59:59", new String[] { "yyyy-MM-dd HH:mm:ss" }); // 2010上海世博会闭幕时间 Date expo2010EndDate = DateUtils.parseDate("2010-10-31 23:59:59", new String[] { "yyyy-MM-dd HH:mm:ss" }); System.out.println(DurationFormatUtils.formatDuration(expo2010BeginDate.getTime() - now.getTime(), "yyyy-MM-dd HH:mm:ss")); System.out.println(DurationFormatUtils.formatDuration(expo2010BeginDate.getTime() - expo2010EndDate.getTime(), "yyyy-MM-dd HH:mm:ss"));
相关文章推荐
- 使用 DurationFormatUtils 计算时间间隔
- 使用 DurationFormatUtils 计算时间间隔
- 使用 DurationFormatUtils 计算时间间隔
- Windows中如何计算时间间隔(2)使用SYSTEMTIME和FILETIME
- 使用 performance-counter 计算时间间隔
- C++计算当前时间点间隔N天的时间(不使用CTimeSpan类)
- python使用datetime模块计算各种时间间隔的方法
- Windows中如何计算时间间隔(1)使用CTime 和CTimeSpan
- 使用TIMESTAMPDIFF计算两个时间戳之间的时间间隔需要注意的细节
- Windows中如何计算时间间隔(1)使用CTime 和CTimeSpan
- C#时间间隔计算(TimeSpan类的使用)
- c# 计算时间间隔
- C#中使用TimeSpan计算两个时间的差值
- C#中使用TimeSpan计算两个时间的差值
- 计算两个日期的时间间隔
- [原] Excel中计算2个日期间的时间间隔
- [转]C#中使用TimeSpan计算两个时间的差值
- 使用DurationFormatUtils把时间区间格式化为"天 时:分:秒"
- 使用DateDiff方法来获取系统时间与指定时间的间隔数
- JavaScript日期时间间隔计算