Get Time Difference
import java.util.Calendar; class Main { public static String getTimeDif(Calendar cal1, Calendar cal2) { long milis1 = cal1.getTimeInMillis(); long milis2 = cal2.getTimeInMillis(); long diff = milis2 - milis1; long diffSeconds = diff / 1000; long diffMinutes = diff / (60 * 1000); String tmp = diffMinutes + " dk. " + (diffSeconds - diffMinutes * 60) + " sn " + (diff - (diffSeconds * 1000)) + " ms."; return tmp; } }