时间相减得到天数
public static long getDaySub(String beginDateStr,String endDateStr)
{
long day=0;
java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("yyyy-MM-dd");
java.util.Date beginDate;
java.util.Date endDate;
try
{
beginDate = format.parse(beginDateStr);
endDate= format.parse(endDateStr);
day=(endDate.getTime()-beginDate.getTime())/(24*60*60*1000);
//System.out.println("相隔的天数="+day);
} catch (ParseException e){
e.printStackTrace();
}
return day;
}