快捷搜索:  as  test  1111  test aNd 8=8  test++aNd+8=8  as++aNd+8=8  as aNd 8=8

通博手机app下载:得到两个日期之间的间隔天数



public static int getDaysBetween (String beginDate, String endDate) throws ParseEx通博手机app下载ception

{

Simpl通博手机app下载eDateFormat format = new SimpleDateFormat("yyyy-MM-dd");

Date bDate = format.parse(beginDate);

Date eDate = format.parse(endDate);

Calendar d1 = new GregorianCalen通博手机app下载dar();

d1.setTime(bDate);

Calendar d2 = new GregorianCalendar();通博手机app下载

d2.setTime(eDate);

int days = d2.get(Calendar.DAY_OF_YEAR) - d1.get(Calendar.DAY_OF_YEAR);

int y2 = d2.get(Calendar.YEAR);

if (d1.get(Calendar.YEAR) != y2)

{

d1 = (Calendar) d1.clone();

do{

days += d1.getActualMaximum(Calendar.DAY_OF_YEAR);//获得通博手机app下载昔时的实际天数

d1.add(Calendar.YEAR, 1);

}while (d1.get(Calendar.YEAR) != y2);

}

return days;

}

免责声明:以上内容源自网络,版权归原作者所有,如有侵犯您的原创版权请告知,我们将尽快删除相关内容。

您可能还会对下面的文章感兴趣: