public String[] getHotelDate(String startdate, String enddate) { SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd"); try { Date d1 = f.parse(startdate); Date d2 = f.parse(enddate); long days = (d2.getTime() - d1.getTime()) / 3600000 / 24; Calendar startcal = Calendar.getInstance(); Calendar endcal = Calendar.getInstance(); startcal.setTime(d1); endcal.setTime(d2); String hotelDate[] = new String[(int) days + 1]; hotelDate[0] = f.format(d1); int i = 1; while (endcal.after(startcal)) { if (i <= days) startcal.add(Calendar.DATE, 1); hotelDate[i] = f.format(startcal.getTime()); i++; } return hotelDate; } catch (ParseException e) { e.printStackTrace(); } return null;
}