首页 > 其他 > 详细

两个时间戳相差多长时间

时间:2015-03-27 19:55:35      阅读:167      评论:0      收藏:0      [点我收藏+]

好无聊……

 1 public class DateUtil {
 2     public static String getDiff(long start,long end) {
 3         int ns = 1000;//一秒多少毫秒
 4         int nm = 60 * ns;//一分钟多少毫秒
 5         int nh = 60 * nm;//一小时多少毫秒
 6         int nd = 24 * nh;//一天多少毫秒
 7         long left = end - start;
 8         int d = (int) (left / nd);//天数
 9         left = left % nd;
10         int h = (int) (left / nh);
11         left = left % nh;
12         int m = (int) (left / nm);
13         left = left % nm;
14         int s = (int) (left / ns);
15         left = left % ns;
16         return d+" d "+h+" h "+m+" m "+s+" s "+left+" ms ";
17     }
18 }

 

两个时间戳相差多长时间

原文:http://www.cnblogs.com/erbin/p/4372597.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!