public static int getDaysBetween (String beginDate String endDate) throws ParseException { SimpleDateFormat format = new SimpleDateFormat(yyyyMMdd); Date bDate = formatparse(beginDate); Date eDate = formatparse(endDate); Calendar d = new GregorianCalendar(); dsetTime(bDate); Calendar d = new GregorianCalendar(); dsetTime(eDate); int days = dget(CalendarDAY_OF_YEAR) dget(CalendarDAY_OF_YEAR); int y = dget(CalendarYEAR); if (dget(CalendarYEAR) != y) { d = (Calendar) dclone(); do { days += dgetActualMaximum(CalendarDAY_OF_YEAR);//得到当年的实际天数 dadd(CalendarYEAR ); } while (dget(CalendarYEAR) != y); } return days; } |