Java tutorial
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static int getDayCounts(Date startDate, Date endDate) { int days = 0; Calendar startCalendar = Calendar.getInstance(); startCalendar.setTime(startDate); Calendar endCalendar = Calendar.getInstance(); endCalendar.setTime(endDate); while (startCalendar.before(endCalendar)) { days++; startCalendar.add(Calendar.DATE, 1); } return days; } }