Here you can find the source of millisecondsBetween(Date dt1, Date dt2)
public static long millisecondsBetween(Date dt1, Date dt2)
//package com.java2s; //License from project: Open Source License import java.util.Date; public class Main { public static long millisecondsBetween(Date dt1, Date dt2) { if (dt1 == null || dt2 == null) return 0; return Math.abs(dt1.getTime() - dt2.getTime()); }//from w w w.j ava 2 s. com }