Here you can find the source of datediff(Calendar c1, Calendar c2)
public static int datediff(Calendar c1, Calendar c2)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static int datediff(Calendar c1, Calendar c2) { if (c1 == null || c2 == null) return -1; long r = c1.getTimeInMillis() - c2.getTimeInMillis(); r = r / (24 * 60 * 60 * 1000);// www. j a v a 2s. c o m return (int) r; } public static int datediff(Date c1, Date c2) { if (c1 == null || c2 == null) return -1; long r = c1.getTime() - c2.getTime(); r = r / (24 * 60 * 60 * 1000); return (int) r; } }