// 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 final static DateFormat df = new SimpleDateFormat("ddMMyyyy");
   public static int diff(String ds1, String ds2) throws Exception {
      return (int)((df.parse(ds1).getTime() - df.parse(ds2).getTime()) / (24*60*60*1000));
   }
   public static void main(String[] args) throws Exception {
      System.out.println(diff("20012004", "18012004"));
   }
}
