public static String getQuot(Date startDate, Date endDate) {
String retQuot = "";
try {
long timeout = endDate.getTime() - startDate.getTime();
double quot = 0.0;
quot = ((double)timeout) / 1000 / 60 / 60 / 24;
DecimalFormat formater = new DecimalFormat();
formater.setMaximumFractionDigits(1);
formater.setGroupingSize(0);
formater.setRoundingMode(RoundingMode.FLOOR);
retQuot = formater.format(quot);
} catch (Exception e) {
e.printStackTrace();
}
return retQuot;
}
计算二个时间间隔天数,保留一位小数
猜你喜欢
转载自blog.csdn.net/gaofenglxx/article/details/60139965
今日推荐
周排行