Here you can find the source of minutesBetween(Date dt1, Date dt2)
public static int minutesBetween(Date dt1, Date dt2)
//package com.java2s; import java.util.Date; public class Main { public static int minutesBetween(Date dt1, Date dt2) { long msDiff = millisecondsBetween(dt1, dt2); if (msDiff == 0) return 0; return (int) (msDiff / 60000); }//from w ww .j ava 2 s. c o m public static long millisecondsBetween(Date dt1, Date dt2) { if (dt1 == null || dt2 == null) return 0; return Math.abs(dt1.getTime() - dt2.getTime()); } }