获取相隔天数,相隔天数,//获取相隔天数 /*
分享于 点击 13971 次 点评:155
获取相隔天数,相隔天数,//获取相隔天数 /*
//获取相隔天数 /**get the days of the gap of the tow date * @param beforedate * @param afterdate * @return * @throws ParseException */static public long getDistinceDay(String beforedate, String afterdate) throws ParseException { SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd"); long dayCount=0; try{ java.util.Date d1 = d.parse(beforedate); java.util.Date d2 = d.parse(afterdate); dayCount = (d2.getTime()-d1.getTime())/(24*60*60*1000); }catch(ParseException e){ System.out.println("Date parse error!"); } return dayCount; }//该片段来自于http://byrx.net
用户点评