Date date =
new
Date(
"2014/1/10 18:20"
);
Date date2 =
new
Date(
"2014/1/11 3:5"
);
long
temp = date2.getTime() - date.getTime();
//相差毫秒数
long
hours = temp /
1000
/
3600
;
//相差小时数
long
temp2 = temp % (
1000
*
3600
);
long
mins = temp2 /
1000
/
60
;
//相差分钟数
System.out.println(
"date2 与 date 相差"
+ hours +
"小时"
+ mins +
"分钟"
);
posted on 2015-04-16 10:40
藤本蔷薇 阅读(134)
评论(0) 编辑 收藏