Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static int daysBetween(Calendar startDate, Calendar endDate) { Calendar date = (Calendar) startDate.clone(); long daysBetween = 0; while (date.before(endDate)) { date.add(Calendar.DAY_OF_MONTH, 1); daysBetween++; } return (int) (daysBetween / 365.25); } }