// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.util.*;
import java.text.*;

public class DateDiff {
   private static DateFormat df = new SimpleDateFormat("dd-MM-yyyy");
   public static int calcDiff(String ds1, String ds2) throws Exception {
      Date d1 = df.parse(ds1);
      Date d2 = df.parse(ds2);
      Calendar c1 = new GregorianCalendar();
      c1.setTime(d1);
      Calendar c2 = new GregorianCalendar();
      c2.setTime(d2);
      int res = 0;
      while(c2.getTime().getTime() >= c1.getTime().getTime()) {
         c2.add(Calendar.YEAR, -1);
         res++;
      }
      res--;
      return res;
   }
   public static void main(String[] args) throws Exception {
      System.out.println(calcDiff("01-12-1993", "02-12-2003"));
      System.out.println(calcDiff("02-12-1993", "02-12-2003"));
      System.out.println(calcDiff("03-12-1993", "02-12-2003"));
   }
}
